pub struct Scope<'d> {
pub file: &'d File,
pub typedef: HashMap<String, &'d Decl>,
}
Expand description
Gather information about the full AST.
Fields§
§file: &'d File
Reference to the source file.
typedef: HashMap<String, &'d Decl>
Collection of Group, Packet, Enum, Struct, Checksum, and CustomField declarations.
Implementations§
Source§impl<'d> Scope<'d>
impl<'d> Scope<'d>
pub fn new(file: &'d File) -> Result<Scope<'d>, Diagnostics>
Sourcepub fn iter_children<'s>(
&'s self,
decl: &'d Decl,
) -> impl Iterator<Item = &'d Decl> + 's
pub fn iter_children<'s>( &'s self, decl: &'d Decl, ) -> impl Iterator<Item = &'d Decl> + 's
Iterate over the child declarations of the selected declaration.
Sourcepub fn get_parent(&self, decl: &Decl) -> Option<&'d Decl>
pub fn get_parent(&self, decl: &Decl) -> Option<&'d Decl>
Return the parent declaration of the selected declaration, if it has one.
Sourcepub fn iter_parents<'s>(
&'s self,
decl: &'d Decl,
) -> impl Iterator<Item = &'d Decl> + 's
pub fn iter_parents<'s>( &'s self, decl: &'d Decl, ) -> impl Iterator<Item = &'d Decl> + 's
Iterate over the parent declarations of the selected declaration.
Sourcepub fn iter_parents_and_self<'s>(
&'s self,
decl: &'d Decl,
) -> impl Iterator<Item = &'d Decl> + 's
pub fn iter_parents_and_self<'s>( &'s self, decl: &'d Decl, ) -> impl Iterator<Item = &'d Decl> + 's
Iterate over the parent declarations of the selected declaration, including the current declaration.
Sourcepub fn iter_fields<'s>(
&'s self,
decl: &'d Decl,
) -> impl Iterator<Item = &'d Field> + 's
pub fn iter_fields<'s>( &'s self, decl: &'d Decl, ) -> impl Iterator<Item = &'d Field> + 's
Iterate over the declaration and its parent’s fields.
Sourcepub fn iter_parent_fields<'s>(
&'s self,
decl: &'d Decl,
) -> impl Iterator<Item = &'d Field> + 's
pub fn iter_parent_fields<'s>( &'s self, decl: &'d Decl, ) -> impl Iterator<Item = &'d Field> + 's
Iterate over the declaration parent’s fields.
Sourcepub fn iter_constraints<'s>(
&'s self,
decl: &'d Decl,
) -> impl Iterator<Item = &'d Constraint> + 's
pub fn iter_constraints<'s>( &'s self, decl: &'d Decl, ) -> impl Iterator<Item = &'d Constraint> + 's
Iterate over the declaration and its parent’s constraints.
Sourcepub fn get_type_declaration(&self, field: &Field) -> Option<&'d Decl>
pub fn get_type_declaration(&self, field: &Field) -> Option<&'d Decl>
Return the type declaration for the selected field, if applicable.
Sourcepub fn is_bitfield(&self, field: &Field) -> bool
pub fn is_bitfield(&self, field: &Field) -> bool
Test if the selected field is a bit-field.
Trait Implementations§
Auto Trait Implementations§
impl<'d> Freeze for Scope<'d>
impl<'d> RefUnwindSafe for Scope<'d>
impl<'d> Send for Scope<'d>
impl<'d> Sync for Scope<'d>
impl<'d> Unpin for Scope<'d>
impl<'d> UnwindSafe for Scope<'d>
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