pub struct SimplificationRegistry { /* private fields */ }Expand description
Simplification registry for all functions
Stores and provides access to function-specific simplification strategies. Separate from FunctionProperties (which stores declarative mathematical data).
Implementations§
Source§impl SimplificationRegistry
impl SimplificationRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new simplification registry
Initializes with all built-in simplification strategies.
Sourcepub fn register(
&mut self,
name: &str,
strategy: Box<dyn SimplificationStrategy>,
)
pub fn register( &mut self, name: &str, strategy: Box<dyn SimplificationStrategy>, )
Register simplification strategy for function
§Arguments
name- Function name (e.g., “log”, “sin”)strategy- Simplification strategy implementation
Sourcepub fn get_strategy(&self, name: &str) -> Option<&dyn SimplificationStrategy>
pub fn get_strategy(&self, name: &str) -> Option<&dyn SimplificationStrategy>
Sourcepub fn simplify_function(&self, name: &str, args: &[Expression]) -> Expression
pub fn simplify_function(&self, name: &str, args: &[Expression]) -> Expression
Simplify function call using registered strategy
§Arguments
name- Function nameargs- Function arguments
§Returns
Simplified expression (unchanged if no strategy registered)
§Examples
use mathhook_core::algebra::simplification::registry::SIMPLIFICATION_REGISTRY;
use mathhook_core::expr;
let result = SIMPLIFICATION_REGISTRY.simplify_function("log", &[expr!(1)]);
assert_eq!(result, expr!(0)); // log(1) = 0Sourcepub fn has_strategy(&self, name: &str) -> bool
pub fn has_strategy(&self, name: &str) -> bool
Check if function has simplification strategy registered
Sourcepub fn strategy_count(&self) -> usize
pub fn strategy_count(&self) -> usize
Get count of registered strategies (for debugging)
Sourcepub fn list_functions(&self) -> Vec<String>
pub fn list_functions(&self) -> Vec<String>
List all registered function names (for debugging)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SimplificationRegistry
impl !RefUnwindSafe for SimplificationRegistry
impl Send for SimplificationRegistry
impl Sync for SimplificationRegistry
impl Unpin for SimplificationRegistry
impl !UnwindSafe for SimplificationRegistry
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more