diff --git a/yoshi-deluxe/Cargo.toml b/yoshi-deluxe/Cargo.toml index bf651d1..912ec41 100644 --- a/yoshi-deluxe/Cargo.toml +++ b/yoshi-deluxe/Cargo.toml @@ -32,7 +32,7 @@ syn = { version = "2.0.101", features = [ "extra-traits", ] } quote = "1.0.40" -proc-macro2 = "1.0.95" +proc-macro2 = { version = "1.0", features = ["span-locations"] } # HTTP client for docs scraping reqwest = { version = "0.12.19", features = [ diff --git a/yoshi-deluxe/src/errors/mod.rs b/yoshi-deluxe/src/errors/mod.rs index c7c5c03..af3978d 100644 --- a/yoshi-deluxe/src/errors/mod.rs +++ b/yoshi-deluxe/src/errors/mod.rs @@ -719,9 +719,9 @@ pub mod recovery { use super::*; /// Attempt automatic error recovery - pub async fn attempt_recovery(operation: F, max_retries: usize) -> Result + pub async fn attempt_recovery(mut operation: F, max_retries: usize) -> Result where - F: Fn() -> Fut, + F: FnMut() -> Fut, Fut: std::future::Future>, { let mut last_error = None; @@ -749,12 +749,12 @@ pub mod recovery { /// Retry operation with specific error patterns pub async fn retry_on_pattern( - operation: F, + mut operation: F, max_retries: usize, retry_patterns: &[&str], ) -> Result where - F: Fn() -> Fut, + F: FnMut() -> Fut, Fut: std::future::Future>, { for attempt in 0..=max_retries { @@ -780,6 +780,18 @@ pub mod recovery { } } +impl From for Yoshi { + fn from(err: syn::Error) -> Self { + Yoshi::new(YoshiKind::Syntax, err.to_string()) + } +} + +impl From for Yoshi { + fn from(err: reqwest::Error) -> Self { + Yoshi::new(YoshiKind::Network, err.to_string()) + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/yoshi-deluxe/src/lib.rs b/yoshi-deluxe/src/lib.rs index 38551b9..2dc980e 100644 --- a/yoshi-deluxe/src/lib.rs +++ b/yoshi-deluxe/src/lib.rs @@ -80,18 +80,20 @@ pub mod types; // Re-export core types and functionality pub use ast::{ASTAnalysisEngine, ASTContext, NodeInfo, NodeType, SurroundingContext}; pub use codegen::CodeGenerationEngine; -pub use types::{CorrectionProposal, CorrectionStrategy, SafetyLevel}; pub use constants::*; pub use diagnostics::CompilerDiagnosticProcessor; -pub use docs::{DocsScrapingEngine, MethodSuggestion}; +pub use docs::DocsScrapingEngine; pub use errors::{AutoCorrectionError, Result}; pub use metrics::{SystemMetrics, SystemMetricsSnapshot}; -pub use system::{AutoCorrectionSystem, SystemConfig}; -pub use types::*; +pub use system::AutoCorrectionSystem; +pub use types::{ + CorrectionProposal, CorrectionStrategy, MethodSuggestion, SafetyLevel, SystemConfig, +}; // Re-export yoshi-std types for convenience +use std::collections::HashMap; pub use yoshi_std::{Hatch, Result as YoshiResult, Yoshi, YoshiKind}; -use yoshi_std::LayText; +use yoshi_std::{Hatchable, LayText}; //-------------------------------------------------------------------------------------------------- // Public API Convenience Functions @@ -213,10 +215,10 @@ pub struct SystemCapabilities { #[cfg(test)] mod integration_tests { use super::*; - use yoshi_std::LayText; use std::path::PathBuf; use tempfile::TempDir; use tokio::fs; + use yoshi_std::LayText; async fn create_test_project() -> Result { let temp_dir = tempfile::tempdir() @@ -587,8 +589,6 @@ pub mod benchmarks { // Module Implementation Files //================================================================================================== - - //-------------------------------------------------------------------------------------------------- // System Health and Monitoring //--------------------------------------------------------------------------------------------------