pub struct Entry {
pub key: Cont,
pub meta: Vec<Meta>,
pub item: TokenStream,
}Expand description
KEY => [META] { ITEM }
Fields§
§key: ContThe continuation that produced this entry, as written in the list.
meta: Vec<Meta>The META elements: checks, meta =, mock(..), type_leak(..).
item: TokenStreamThe raw item tokens.
Implementations§
Source§impl Entry
impl Entry
Sourcepub fn mock(&self) -> Option<Path>
pub fn mock(&self) -> Option<Path>
The path of the mock(path) META element, if there is one: the item stands
in for the item at that path.
Sourcepub fn find_meta(&self, name: &str) -> Option<&Meta>
pub fn find_meta(&self, name: &str) -> Option<&Meta>
The first META element whose last path segment is name. Use it to read
a meta = lib::info(..) or a check.
Sourcepub fn type_leak(&self) -> Result<Option<TypeLeak>>
pub fn type_leak(&self) -> Result<Option<TypeLeak>>
The type_leak(..) META of an entry announced with repeater = ...
Unknown keys are ignored.
Sourcepub fn has_check(&self, name: &str) -> bool
pub fn has_check(&self, name: &str) -> bool
Whether META lists a check whose last path segment is name. Only the
last segment is compared, since the path is as the definer wrote it.
Sourcepub fn owned_attrs(&self) -> OwnedAttrs
pub fn owned_attrs(&self) -> OwnedAttrs
The attribute names that the definition’s checks own: the attrs(..) META
element (empty without one). The definer removed these attributes from the
item it emitted, but they are still in item, where a
callback can read them (OwnedAttrs::find).
A callback that emits the item itself must remove them first, because rustc
rejects an attribute that no macro declares. Use
item_without_owned_attrs.
Sourcepub fn item_without_owned_attrs(&self) -> Result<Item>
pub fn item_without_owned_attrs(&self) -> Result<Item>
The payload parsed as an item, without the owned attributes: the item as the
definer emitted it. The same as item when the definition has
no owned attributes.
Trait Implementations§
Source§impl ToTokens for Entry
impl ToTokens for Entry
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 Entry
impl !Sync for Entry
impl Freeze for Entry
impl RefUnwindSafe for Entry
impl Unpin for Entry
impl UnsafeUnpin for Entry
impl UnwindSafe for Entry
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§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.