Enum Meta

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(crate::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: &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: &Self) -> Result<&Path>

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

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

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

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

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

impl Clone for Meta

fn clone(self: &Self) -> Self

impl Debug for Meta

fn fmt(self: &Self, formatter: &mut Formatter<'_>) -> Result

impl Eq for Meta

impl Freeze for Meta

impl From for Meta

fn from(meta: Path) -> Meta

impl From for Meta

fn from(meta: MetaNameValue) -> Meta

impl From for Meta

fn from(meta: MetaList) -> Meta

impl Hash for Meta

fn hash<H>(self: &Self, state: &mut H)
where
    H: Hasher

impl Parse for Meta

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

impl PartialEq for Meta

fn eq(self: &Self, other: &Self) -> bool

impl RefUnwindSafe for Meta

impl Send for Meta

impl Sync for Meta

impl ToTokens for Meta

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

impl Unpin for Meta

impl UnsafeUnpin for Meta

impl UnwindSafe for Meta

impl<T> Any for Meta

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Meta

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Meta

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

impl<T> CloneToUninit for Meta

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

impl<T> From for Meta

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Spanned for Meta

fn span(self: &Self) -> Span

impl<T> ToOwned for Meta

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Meta

fn into(self: 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 for Meta

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

impl<T, U> TryInto for Meta

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