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>

source

pub fn new(file: &'d File<A>) -> Result<Scope<'d, A>, Diagnostics>

source

pub fn get_parent(&self, decl: &Decl<A>) -> Option<&'d Decl<A>>

Return the parent declaration of the selected declaration, if it has one.

source

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.

source

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.

source

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§

source§

impl<'d, A: Debug + Annotation> Debug for Scope<'d, A>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'d, A: Default + Annotation> Default for Scope<'d, A>

source§

fn default() -> Scope<'d, A>

Returns the “default value” for a type. Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.