pub trait Complexity {
const CLASS: ComplexityClass;
const DETAIL: &'static str = "";
}Expand description
Compile-time complexity-class declaration. Every public solver / sampler /
analyser in this crate implements this trait, exposing its worst-case
class as a const so callers can match on it at compile time.
fn pick_solver<S: Complexity>() {
match S::CLASS {
ComplexityClass::Logarithmic | ComplexityClass::SubLinear => {
// use it — edge-safe
}
_ => {
// fall back to something cheaper or refuse
}
}
}Required Associated Constants§
Sourceconst CLASS: ComplexityClass
const CLASS: ComplexityClass
Worst-case complexity class on a single-query call. For iterative solvers this is the per-iter cost; the iteration count is bounded by other configuration (max_iterations, tolerance, ef_construction).
Provided Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".