pub enum Meta {
Path(Path),
List(MetaList),
NameValue(MetaNameValue),
}Expand description
Content of a compile-time structured attribute.
§Path
A meta path is like the test in #[test].
§List
A meta list is like the derive(Copy) in #[derive(Copy)].
§NameValue
A name-value meta is like the path = "..." in #[path = "sys/windows.rs"].
§Syntax tree enum
This type is a syntax tree enum.
Variants§
Path(Path)
List(MetaList)
A structured list within an attribute, like derive(Copy, Clone).
NameValue(MetaNameValue)
A name-value pair within an attribute, like feature = "nightly".
Implementations§
Source§impl Meta
impl Meta
Sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
Returns the path that begins this structured meta item.
For example this would return the test in #[test], the derive in
#[derive(Copy)], and the path in #[path = "sys/windows.rs"].
Sourcepub fn require_path_only(&self) -> Result<&Path, Error>
pub fn require_path_only(&self) -> Result<&Path, Error>
Error if this is a Meta::List or Meta::NameValue.
Sourcepub fn require_list(&self) -> Result<&MetaList, Error>
pub fn require_list(&self) -> Result<&MetaList, Error>
Error if this is a Meta::Path or Meta::NameValue.
Sourcepub fn require_name_value(&self) -> Result<&MetaNameValue, Error>
pub fn require_name_value(&self) -> Result<&MetaNameValue, Error>
Error if this is a Meta::Path or Meta::List.
Trait Implementations§
impl Eq for Meta
derive or full only.Source§impl From<MetaNameValue> for Meta
impl From<MetaNameValue> for Meta
Source§fn from(meta: MetaNameValue) -> Meta
fn from(meta: MetaNameValue) -> Meta
Source§impl ToTokens for Meta
impl ToTokens for Meta
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl !Send for Meta
impl !Sync for Meta
impl Freeze for Meta
impl RefUnwindSafe for Meta
impl Unpin for Meta
impl UnsafeUnpin for Meta
impl UnwindSafe for Meta
Blanket Implementations§
Source§impl<S> AssignWithType for S
impl<S> AssignWithType for S
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<C, E> EntryToVal<C> for Ewhere
C: Collection<Entry = E>,
impl<C, E> EntryToVal<C> for Ewhere
C: Collection<Entry = E>,
Source§type Val = <C as Collection>::Val
type Val = <C as Collection>::Val
Entry in complex collections.
For example, in a HashMap, while Entry might be a ( key, value ) tuple, Val might only be the value part.Source§fn entry_to_val(self) -> <E as EntryToVal<C>>::Val
fn entry_to_val(self) -> <E as EntryToVal<C>>::Val
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.Source§impl<C, Val> ValToEntry<C> for Valwhere
C: CollectionValToEntry<Val>,
impl<C, Val> ValToEntry<C> for Valwhere
C: CollectionValToEntry<Val>,
Source§fn val_to_entry(self) -> <C as CollectionValToEntry<Val>>::Entry
fn val_to_entry(self) -> <C as CollectionValToEntry<Val>>::Entry
Invokes the val_to_entry function of the CollectionValToEntry trait to convert the value to an entry.
Source§type Entry = <C as CollectionValToEntry<Val>>::Entry
type Entry = <C as CollectionValToEntry<Val>>::Entry
Entry is defined by the Collection trait.