pub trait AcceptUpperBound {
type Output;
type Eval<const UPPER: usize>: Const<Type = Self::Output>;
const DESIRED_GENERIC: usize;
}Expand description
Allows implementing a callback pattern that accepts an upper bound for a desired generic const parameter.
The trait works by allowing implementors to specify, for each upper bound, a value that is
computed from that upper bound. This value is represented as a generic associated type with
bound Const, as this is currently the only way to implement a const item with generics
in a trait.
When passed to eval_with_upper_bound, Eval::<UPPER>::VALUE will be evaluated
with a parameter UPPER that satisfies DESIRED_GENERIC <= UPPER < 2 * DESIRED_GENERIC.
Required Associated Constants§
Sourceconst DESIRED_GENERIC: usize
const DESIRED_GENERIC: usize
The desired value and lower bound that the implementor wants to be passed to Self::Eval.
Required Associated Types§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.