pub trait Probe {
const VALUE: bool = false;
}
Expand description
Trait used to combine with zero-sized types to calculate at compile time some property of a type.
The trick uses the fact that an associated constant has higher priority than a trait constant, so we can use the trait to define the false case.
The true case is defined in the zero-sized type’s impl block, which is gated on some property like trait bound or only being implemented for fixed concrete types.
Provided Associated Constants§
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.