Skip to main content

ComplexityIntrospect

Trait ComplexityIntrospect 

Source
pub trait ComplexityIntrospect {
    // Required method
    fn complexity_class(&self) -> ComplexityClass;

    // Provided method
    fn complexity_detail(&self) -> &'static str { ... }
}
Expand description

Object-safe runtime introspection. Defaulting impl<T: Complexity> so any type with a static Complexity impl gets ComplexityIntrospect for free, and a dyn ComplexityIntrospect query works on solver trait objects.

fn within_budget(s: &dyn ComplexityIntrospect, max: ComplexityClass) -> bool {
    s.complexity_class() <= max
}

Required Methods§

Provided Methods§

Source

fn complexity_detail(&self) -> &'static str

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§