Enum Meta

pub enum Meta

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

impl Meta

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"].

fn require_path_only(&self) -> Result<&Path>

Error if this is a Meta::List or Meta::NameValue.

fn require_list(&self) -> Result<&MetaList>

Error if this is a Meta::Path or Meta::NameValue.

fn require_name_value(&self) -> Result<&MetaNameValue>

Error if this is a Meta::Path or Meta::List.

Trait Implementations

impl Clone for Meta

fn clone(&self) -> Self

impl From<MetaList> for Meta

fn from(meta: MetaList) -> Meta

impl From<MetaNameValue> for Meta

fn from(meta: MetaNameValue) -> Meta

impl From<Path> for Meta

fn from(meta: Path) -> Meta

impl Parse for Meta

fn parse(input: ParseStream<'_>) -> Result<Self>

impl ToTokens for Meta

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

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

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Meta where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Meta where T: ?Sized,

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

impl<T> CloneToUninit for Meta where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Meta

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Spanned for Meta where T: Spanned + ?Sized,

fn span(&self) -> Span

impl<T> ToOwned for Meta where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Meta where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for Meta where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Meta where U: TryFrom<T>,

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