Trait FromMeta

Source
pub trait FromMeta: Sized {
    // Required method
    fn from_meta(meta: &MetaItem) -> Result<Self, Diagnostic>;

    // Provided methods
    fn from_attr(attr: &Attribute) -> Result<Self, Diagnostic> { ... }
    fn from_attrs(
        name: &str,
        attrs: &[Attribute],
    ) -> Result<Vec<Self>, Diagnostic> { ... }
    fn one_from_attrs(
        name: &str,
        attrs: &[Attribute],
    ) -> Result<Option<Self>, Diagnostic> { ... }
    fn default() -> Option<Self> { ... }
}

Required Methods§

Provided Methods§

Source

fn from_attr(attr: &Attribute) -> Result<Self, Diagnostic>

Source

fn from_attrs(name: &str, attrs: &[Attribute]) -> Result<Vec<Self>, Diagnostic>

Source

fn one_from_attrs( name: &str, attrs: &[Attribute], ) -> Result<Option<Self>, Diagnostic>

Source

fn default() -> 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.

Implementations on Foreign Types§

Source§

impl FromMeta for bool

Source§

impl FromMeta for isize

Source§

impl FromMeta for usize

Source§

impl FromMeta for String

Source§

impl<T> FromMeta for Option<T>
where T: FromMeta,

Implementors§

Source§

impl FromMeta for Expr

Source§

impl FromMeta for TokenStream

Source§

impl<T> FromMeta for SpanWrapped<T>
where T: FromMeta,

Source§

impl<T, P> FromMeta for Punctuated<T, P>
where T: Parse, P: Parse,