pub struct AuthoredItem<'tokens> { /* private fields */ }Expand description
A checked structural lens into one supported complete caller-authored Rust item.
Every fragment borrows the same captured material as AuthoredItem::preserved.
The lens identifies only an item’s outer attributes, visibility, qualifiers, family, optional name, generic-parameter run, where-clause run, signature run, and optional body group.
Implementations§
Source§impl<'tokens> AuthoredItem<'tokens>
impl<'tokens> AuthoredItem<'tokens>
Sourcepub const fn preserved(self) -> CapturedFragment<'tokens>
pub const fn preserved(self) -> CapturedFragment<'tokens>
The complete authored token reading this lens stands over.
Sourcepub const fn attributes(self) -> CapturedFragment<'tokens>
pub const fn attributes(self) -> CapturedFragment<'tokens>
The leading outer attributes, in authored order.
Sourcepub const fn visibility(self) -> CapturedFragment<'tokens>
pub const fn visibility(self) -> CapturedFragment<'tokens>
The explicit visibility tokens, or an empty fragment for inherited visibility.
Sourcepub const fn qualifiers(self) -> CapturedFragment<'tokens>
pub const fn qualifiers(self) -> CapturedFragment<'tokens>
The qualifiers between visibility and the item-family keyword.
Sourcepub const fn kind(self) -> AuthoredItemKind
pub const fn kind(self) -> AuthoredItemKind
The recognized structural item family.
Sourcepub const fn kind_token(self) -> &'tokens CapturedTokenTree
pub const fn kind_token(self) -> &'tokens CapturedTokenTree
The exact token carrying the item-family keyword.
Sourcepub fn name(self) -> Option<(&'tokens CapturedTokenTree, &'tokens str)>
pub fn name(self) -> Option<(&'tokens CapturedTokenTree, &'tokens str)>
The optional item-name token and its ordinary or raw spelling.
Sourcepub const fn generics(self) -> Option<CapturedFragment<'tokens>>
pub const fn generics(self) -> Option<CapturedFragment<'tokens>>
The exact generic-parameter run, including its angle punctuation, where one is present.
Sourcepub const fn where_clause(self) -> Option<CapturedFragment<'tokens>>
pub const fn where_clause(self) -> Option<CapturedFragment<'tokens>>
The exact where-clause run, beginning with where, where one is present.
Sourcepub const fn signature(self) -> CapturedFragment<'tokens>
pub const fn signature(self) -> CapturedFragment<'tokens>
The item-signature run after outer attributes and before its first body group or terminator.
Sourcepub fn body(self) -> Option<(CapturedDelimiter, CapturedFragment<'tokens>)>
pub fn body(self) -> Option<(CapturedDelimiter, CapturedFragment<'tokens>)>
The optional body group’s delimiter and exact inner token fragment.
Sourcepub const fn unsafe_token(self) -> Option<&'tokens CapturedTokenTree>
pub const fn unsafe_token(self) -> Option<&'tokens CapturedTokenTree>
The explicit unsafe qualifier token on this item, where the caller wrote one.
This is a local syntactic boundary, not a global unsafe scan or a soundness claim.
Trait Implementations§
Source§impl<'tokens> Clone for AuthoredItem<'tokens>
impl<'tokens> Clone for AuthoredItem<'tokens>
Source§fn clone(&self) -> AuthoredItem<'tokens>
fn clone(&self) -> AuthoredItem<'tokens>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more