Trait Lit

Source
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::Components, 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§

Source

const SELF: Self

Source

const NAME: &'static RefStr

Provided Methods§

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.

Implementors§

Source§

impl Lit for Heads

Source§

const SELF: Self = Self

Source§

const NAME: &'static RefStr = name::HEADS

Source§

impl Lit for Namespaces

Source§

const SELF: Self = Self

Source§

const NAME: &'static RefStr = name::NAMESPACES

Source§

impl Lit for Notes

Source§

const SELF: Self = Self

Source§

const NAME: &'static RefStr = name::NOTES

Source§

impl Lit for Refs

Source§

const SELF: Self = Self

Source§

const NAME: &'static RefStr = name::REFS

Source§

impl Lit for Remotes

Source§

const SELF: Self = Self

Source§

const NAME: &'static RefStr = name::REMOTES

Source§

impl Lit for Tags

Source§

const SELF: Self = Self

Source§

const NAME: &'static RefStr = name::TAGS