pub enum AttributeContext<'a> {
Crate(&'a File),
File(&'a File),
Item(&'a Item),
Variant(&'a Variant),
Field(&'a Field),
ImplItem(&'a ImplItem),
}Variants§
Crate(&'a File)
The root of a crate, i.e. the inner attributes of its lib.rs/main.rs.
Distinct from AttributeContext::File (a file-module) because only the
crate root carries the primary program’s default identity. Constructed
explicitly (never via From) so From<&syn::File> keeps mapping to
AttributeContext::File.
File(&'a File)
A file-module, i.e. the inner attributes of a mod foo; living in its
own foo.rs.
Item(&'a Item)
A top-level item, such as a struct, enum or inline mod { .. }.
Variant(&'a Variant)
An enum variant.
Field(&'a Field)
A field of a struct or an enum variant.
ImplItem(&'a ImplItem)
An item within an impl block.
Implementations§
Source§impl<'a> AttributeContext<'a>
impl<'a> AttributeContext<'a>
pub fn get_fields(&self) -> Option<&'a Fields>
pub fn get_named_fields(&self) -> Option<&'a FieldsNamed>
Trait Implementations§
Source§impl<'a> Debug for AttributeContext<'a>
impl<'a> Debug for AttributeContext<'a>
Source§impl<'a> From<&'a Field> for AttributeContext<'a>
impl<'a> From<&'a Field> for AttributeContext<'a>
Source§impl<'a> From<&'a File> for AttributeContext<'a>
impl<'a> From<&'a File> for AttributeContext<'a>
Source§impl<'a> From<&'a ImplItem> for AttributeContext<'a>
impl<'a> From<&'a ImplItem> for AttributeContext<'a>
Source§impl<'a> From<&'a Item> for AttributeContext<'a>
impl<'a> From<&'a Item> for AttributeContext<'a>
Source§impl<'a> From<&'a Variant> for AttributeContext<'a>
impl<'a> From<&'a Variant> for AttributeContext<'a>
Source§impl<'a> PartialEq for AttributeContext<'a>
impl<'a> PartialEq for AttributeContext<'a>
impl<'a> StructuralPartialEq for AttributeContext<'a>
Auto Trait Implementations§
impl<'a> !Send for AttributeContext<'a>
impl<'a> !Sync for AttributeContext<'a>
impl<'a> Freeze for AttributeContext<'a>
impl<'a> RefUnwindSafe for AttributeContext<'a>
impl<'a> Unpin for AttributeContext<'a>
impl<'a> UnsafeUnpin for AttributeContext<'a>
impl<'a> UnwindSafe for AttributeContext<'a>
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
Mutably borrows from an owned value. Read more