pub trait Lit: Sized + Sealed {
const SELF: Self;
const NAME: &'static RefStr;
// Provided method
fn from_component(c: &Component<'_>) -> Option<Self> { ... }
}
Expand description
A literal RefStr
.
Types implementing Lit
must be name::Component
s, and provide a
conversion from a component iff the component’s RefStr
representation
is equal to Lit::NAME
. Because these morphisms can only be guaranteed
axiomatically, the trait can not currently be implemented by types outside
of this crate.
Lit
types are useful for efficiently creating known-valid Qualified
refs, and sometimes for pattern matching.
Required Associated Constants§
Provided Methods§
fn from_component(c: &Component<'_>) -> Option<Self>
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.