pub enum MetaItemInner {
MetaItem(MetaItem),
Lit(MetaItemLit),
}
Expand description
Values inside meta item lists.
E.g., each of Clone
, Copy
in #[derive(Clone, Copy)]
.
Variants§
MetaItem(MetaItem)
A full MetaItem, for recursive meta items.
Lit(MetaItemLit)
A literal.
E.g., "foo"
, 64
, true
.
Implementations§
Source§impl MetaItemInner
impl MetaItemInner
pub fn span(&self) -> Span
Sourcepub fn ident(&self) -> Option<Ident>
pub fn ident(&self) -> Option<Ident>
For a single-segment meta item, returns its name; otherwise, returns None
.
pub fn name_or_empty(&self) -> Symbol
Sourcepub fn has_name(&self, name: Symbol) -> bool
pub fn has_name(&self, name: Symbol) -> bool
Returns true
if this list item is a MetaItem with a name of name
.
Sourcepub fn meta_item_list(&self) -> Option<&[MetaItemInner]>
pub fn meta_item_list(&self) -> Option<&[MetaItemInner]>
Gets a list of inner meta items from a list MetaItem
type.
Sourcepub fn singleton_lit_list(&self) -> Option<(Symbol, &MetaItemLit)>
pub fn singleton_lit_list(&self) -> Option<(Symbol, &MetaItemLit)>
If it’s a singleton list of the form foo(lit)
, returns the foo
and
the lit
.
Sourcepub fn name_value_literal_span(&self) -> Option<Span>
pub fn name_value_literal_span(&self) -> Option<Span>
Sourcepub fn value_str(&self) -> Option<Symbol>
pub fn value_str(&self) -> Option<Symbol>
Gets the string value if self
is a MetaItem
and the MetaItem
is a
MetaItemKind::NameValue
variant containing a string, otherwise None
.
Sourcepub fn lit(&self) -> Option<&MetaItemLit>
pub fn lit(&self) -> Option<&MetaItemLit>
Returns the MetaItemLit
if self
is a MetaItemInner::Literal
s.
Sourcepub fn meta_item_or_bool(&self) -> Option<&MetaItemInner>
pub fn meta_item_or_bool(&self) -> Option<&MetaItemInner>
Returns the MetaItem
if self
is a MetaItemInner::MetaItem
or if it’s
MetaItemInner::Lit(MetaItemLit { kind: LitKind::Bool(_), .. })
.
Sourcepub fn meta_item(&self) -> Option<&MetaItem>
pub fn meta_item(&self) -> Option<&MetaItem>
Returns the MetaItem
if self
is a MetaItemInner::MetaItem
.
Sourcepub fn is_meta_item(&self) -> bool
pub fn is_meta_item(&self) -> bool
Returns true
if the variant is MetaItem
.
fn from_tokens<'a, I>(tokens: &mut Peekable<I>) -> Option<MetaItemInner>
Trait Implementations§
Source§impl Clone for MetaItemInner
impl Clone for MetaItemInner
Source§fn clone(&self) -> MetaItemInner
fn clone(&self) -> MetaItemInner
Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MetaItemInner
impl Debug for MetaItemInner
Source§impl<__D: SpanDecoder> Decodable<__D> for MetaItemInner
impl<__D: SpanDecoder> Decodable<__D> for MetaItemInner
Source§impl<__E: SpanEncoder> Encodable<__E> for MetaItemInner
impl<__E: SpanEncoder> Encodable<__E> for MetaItemInner
Source§impl<__CTX> HashStable<__CTX> for MetaItemInnerwhere
__CTX: HashStableContext,
impl<__CTX> HashStable<__CTX> for MetaItemInnerwhere
__CTX: HashStableContext,
fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)
Auto Trait Implementations§
impl DynSend for MetaItemInner
impl DynSync for MetaItemInner
impl Freeze for MetaItemInner
impl !RefUnwindSafe for MetaItemInner
impl !Send for MetaItemInner
impl !Sync for MetaItemInner
impl Unpin for MetaItemInner
impl !UnwindSafe for MetaItemInner
Blanket Implementations§
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 88 bytes
Size for each variant:
MetaItem
: 88 bytesLit
: 40 bytes