Struct pdl_compiler::analyzer::Scope
source · pub struct Scope<'d, A: Annotation> {
pub typedef: HashMap<String, &'d Decl<A>>,
}
Expand description
Gather information about the full AST.
Fields§
§typedef: HashMap<String, &'d Decl<A>>
Collection of Group, Packet, Enum, Struct, Checksum, and CustomField declarations.
Implementations§
source§impl<'d, A: Annotation + Default> Scope<'d, A>
impl<'d, A: Annotation + Default> Scope<'d, A>
pub fn new(file: &'d File<A>) -> Result<Scope<'d, A>, Diagnostics>
sourcepub fn get_parent(&self, decl: &Decl<A>) -> Option<&'d Decl<A>>
pub fn get_parent(&self, decl: &Decl<A>) -> Option<&'d Decl<A>>
Return the parent declaration of the selected declaration, if it has one.
sourcepub fn iter_parents<'s>(
&'s self,
decl: &'d Decl<A>
) -> impl Iterator<Item = &'d Decl<A>> + 's
pub fn iter_parents<'s>( &'s self, decl: &'d Decl<A> ) -> impl Iterator<Item = &'d Decl<A>> + 's
Iterate over the parent declarations of the selected declaration.
sourcepub fn iter_fields<'s>(
&'s self,
decl: &'d Decl<A>
) -> impl Iterator<Item = &'d Field<A>> + 's
pub fn iter_fields<'s>( &'s self, decl: &'d Decl<A> ) -> impl Iterator<Item = &'d Field<A>> + 's
Iterate over the declaration and its parent’s fields.
sourcepub fn get_declaration(&self, field: &'d Field<A>) -> Option<&'d Decl<A>>
pub fn get_declaration(&self, field: &'d Field<A>) -> Option<&'d Decl<A>>
Return the type declaration for the selected field, if applicable.
Trait Implementations§
Auto Trait Implementations§
impl<'d, A> RefUnwindSafe for Scope<'d, A>where <A as Annotation>::DeclAnnotation: RefUnwindSafe, <A as Annotation>::FieldAnnotation: RefUnwindSafe,
impl<'d, A> Send for Scope<'d, A>where <A as Annotation>::DeclAnnotation: Sync, <A as Annotation>::FieldAnnotation: Sync,
impl<'d, A> Sync for Scope<'d, A>where <A as Annotation>::DeclAnnotation: Sync, <A as Annotation>::FieldAnnotation: Sync,
impl<'d, A> Unpin for Scope<'d, A>
impl<'d, A> UnwindSafe for Scope<'d, A>where <A as Annotation>::DeclAnnotation: RefUnwindSafe, <A as Annotation>::FieldAnnotation: RefUnwindSafe,
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