[][src]Trait evitable_syn_meta_ext::FromMeta

pub trait FromMeta: Sized {
    fn from_nested_meta(item: &NestedMeta) -> Result<Self> { ... }
fn from_meta(item: &Meta) -> Result<Self> { ... }
fn from_empty() -> Result<Self> { ... }
fn from_list(items: &[&NestedMeta]) -> Result<Self> { ... }
fn from_value(value: &MetaValue) -> Result<Self> { ... }
fn from_lit(lit: &Lit) -> Result<Self> { ... }
fn from_char<S: Spanned>(value: char, span: &S) -> Result<Self> { ... }
fn from_int<S: Spanned>(value: u64, span: &S) -> Result<Self> { ... }
fn from_path(value: &Path) -> Result<Self> { ... }
fn from_string<S: Spanned>(value: &str, span: &S) -> Result<Self> { ... }
fn from_bool<S: Spanned>(value: bool, span: &S) -> Result<Self> { ... }
fn from_ident(value: &Ident) -> Result<Self> { ... } }

Provided methods

fn from_nested_meta(item: &NestedMeta) -> Result<Self>

fn from_meta(item: &Meta) -> Result<Self>

Create an instance from a syn::Meta by dispatching to the format-appropriate trait function. This generally should not be overridden by implementers.

Error Spans

If this method is overridden and can introduce errors that weren't passed up from other from_meta calls, the override must call with_span on the error using the item to make sure that the emitted diagnostic points to the correct location in source code.

fn from_empty() -> Result<Self>

Create an instance from the presence of the word in the attribute with no additional options specified.

fn from_list(items: &[&NestedMeta]) -> Result<Self>

Create an instance from a list of nested meta items.

fn from_value(value: &MetaValue) -> Result<Self>

Create an instance from a literal value of either foo = "bar" or foo("bar"). This dispatches to the appropriate method based on the type of literal encountered, and generally should not be overridden by implementers.

Error Spans

If this method is overridden, the override must make sure to add value's span information to the returned error by calling with_span(value) on the Error instance.

fn from_lit(lit: &Lit) -> Result<Self>

fn from_char<S: Spanned>(value: char, span: &S) -> Result<Self>

Create an instance from a char literal in a value position.

fn from_int<S: Spanned>(value: u64, span: &S) -> Result<Self>

Create an instance from a int literal in a value position.

fn from_path(value: &Path) -> Result<Self>

Create an instance from a char literal in a value position.

fn from_string<S: Spanned>(value: &str, span: &S) -> Result<Self>

Create an instance from a string literal in a value position.

fn from_bool<S: Spanned>(value: bool, span: &S) -> Result<Self>

Create an instance from a bool literal in a value position.

fn from_ident(value: &Ident) -> Result<Self>

Loading content...

Implementations on Foreign Types

impl FromMeta for ()[src]

impl FromMeta for bool[src]

impl FromMeta for AtomicBool[src]

impl FromMeta for String[src]

impl FromMeta for u8[src]

impl FromMeta for u16[src]

impl FromMeta for u32[src]

impl FromMeta for u64[src]

impl FromMeta for usize[src]

impl FromMeta for i8[src]

impl FromMeta for i16[src]

impl FromMeta for i32[src]

impl FromMeta for i64[src]

impl FromMeta for isize[src]

impl FromMeta for f32[src]

impl FromMeta for f64[src]

impl FromMeta for Ident[src]

Parsing support for identifiers. This attempts to preserve span information when available, but also supports parsing strings with the call site as the emitted span.

impl FromMeta for Path[src]

Parsing support for paths. This attempts to preserve span information when available, but also supports parsing strings with the call site as the emitted span.

impl FromMeta for Lit[src]

impl FromMeta for LitInt[src]

impl FromMeta for LitFloat[src]

impl FromMeta for LitStr[src]

impl FromMeta for LitByte[src]

impl FromMeta for LitByteStr[src]

impl FromMeta for LitChar[src]

impl FromMeta for LitBool[src]

impl FromMeta for Literal[src]

impl FromMeta for RenameRule[src]

impl<T: FromMeta> FromMeta for Option<T>[src]

impl<T: FromMeta> FromMeta for Box<T>[src]

impl<T: FromMeta> FromMeta for Result<T, Meta>[src]

Parses the meta-item, and in case of error preserves a copy of the input for later analysis.

impl<T: FromMeta> FromMeta for Rc<T>[src]

impl<T: FromMeta> FromMeta for Arc<T>[src]

impl<T: FromMeta> FromMeta for Vec<T>[src]

Loading content...

Implementors

impl FromMeta for Meta[src]

impl<T: FromMeta> FromMeta for evitable_syn_meta_ext::error::Result<T>[src]

Loading content...