pub enum FieldsWithOpts<O> {
    Named {
        brace_token: Brace,
        fields: Punctuated<FieldWithOpts<O>, Comma>,
    },
    Unnamed {
        paren_token: Paren,
        fields: Punctuated<FieldWithOpts<O>, Comma>,
    },
    Unit,
}
Available on crate feature attr_parse only.
Expand description

Fields with options parsed.

Variants§

§

Named

Fields

§brace_token: Brace
§

Unnamed

Fields

§paren_token: Paren
§

Unit

Implementations§

source§

impl<O> FieldsWithOpts<O>where O: AttributeOptions,

source

pub fn from_predicate<F>( fields: Fields, predicate: F ) -> Result<FieldsWithOpts<O>, Error>where F: FnMut(&Attribute) -> bool,

Construct from the given fields using attributes the predicate returns true for. The remaining attributes will be kept on the field.

source

pub fn from_attr_name( input: Fields, attr_name: &str ) -> Result<FieldsWithOpts<O>, Error>

from_predicate shorthand for filtering by attribute name

Trait Implementations§

source§

impl<O> ToTokens for FieldsWithOpts<O>

source§

fn to_tokens(&self, tokens: &mut TokenStream)

Write self to the given TokenStream. Read more
source§

fn to_token_stream(&self) -> TokenStream

Convert self directly into a TokenStream object. Read more
source§

fn into_token_stream(self) -> TokenStreamwhere Self: Sized,

Convert self directly into a TokenStream object. Read more

Auto Trait Implementations§

§

impl<O> RefUnwindSafe for FieldsWithOpts<O>where O: RefUnwindSafe,

§

impl<O> !Send for FieldsWithOpts<O>

§

impl<O> !Sync for FieldsWithOpts<O>

§

impl<O> Unpin for FieldsWithOpts<O>where O: Unpin,

§

impl<O> UnwindSafe for FieldsWithOpts<O>where O: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Spanned for Twhere T: Spanned + ?Sized,

source§

fn span(&self) -> Span

Returns a Span covering the complete contents of this syntax tree node, or Span::call_site() if this node is empty.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.