attribute_derive

Trait AttributeIdent

Source
pub trait AttributeIdent {
    const IDENTS: &'static [&'static str];

    // Provided methods
    fn is_ident(path: &Path) -> bool { ... }
    fn ident() -> &'static str { ... }
}
Expand description

Helper trait providing the path for an attribute.

Automatically derived with FromAttr, if #[attribute(ident = "some_ident")] is provided.

Required Associated Constants§

Source

const IDENTS: &'static [&'static str]

List of idents, must contain at least one ident.

Provided Methods§

Source

fn is_ident(path: &Path) -> bool

Tests if Attribute matches one of the idents.

Source

fn ident() -> &'static str

Returns default ident.

§Panics

The default implementation panics if IDENTS is empty. Implementors should ensure this is not the case.

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.

Implementations on Foreign Types§

Source§

impl<T: AttributeIdent> AttributeIdent for Option<T>

Source§

const IDENTS: &'static [&'static str] = T::IDENTS

Implementors§