pub trait EducationalOperation {
type Output;
// Required methods
fn execute_with_steps(&self) -> (Self::Output, StepByStepExplanation);
fn educational_context(&self) -> OperationContext;
// Provided methods
fn execute_fast(&self) -> Self::Output { ... }
fn can_explain(&self) -> bool { ... }
fn estimated_steps(&self) -> Option<usize> { ... }
}Expand description
Trait for mathematical operations that provide educational explanations
This trait establishes the architectural pattern for integrating step-by-step educational explanations into mathematical operations. All operations that want to provide educational value should implement this trait.
The trait provides two execution paths:
execute_with_steps- Full educational mode with detailed explanationsexecute_fast- Performance-optimized mode without explanation overhead
Required Associated Types§
Required Methods§
fn execute_with_steps(&self) -> (Self::Output, StepByStepExplanation)
fn educational_context(&self) -> OperationContext
Provided Methods§
fn execute_fast(&self) -> Self::Output
fn can_explain(&self) -> bool
fn estimated_steps(&self) -> Option<usize>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".