Struct pdl_compiler::ast::Decl
source · pub struct Decl<A: Annotation> {
pub loc: SourceRange,
pub annot: A::DeclAnnotation,
pub desc: DeclDesc<A>,
}
Fields§
§loc: SourceRange
§annot: A::DeclAnnotation
§desc: DeclDesc<A>
Implementations§
source§impl<A: Annotation> Decl<A>
impl<A: Annotation> Decl<A>
pub fn new(loc: SourceRange, desc: DeclDesc<A>) -> Decl<A>
pub fn annotate<F, B: Annotation>( &self, annot: B::DeclAnnotation, annotate_fields: F ) -> Decl<B>where F: FnOnce(&[Field<A>]) -> Vec<Field<B>>,
pub fn id(&self) -> Option<&str>
pub fn parent_id(&self) -> Option<&str>
pub fn constraints(&self) -> Iter<'_, Constraint>
pub fn fields(&self) -> Iter<'_, Field<A>>
sourcepub fn payload(&self) -> Option<&Field<A>>
pub fn payload(&self) -> Option<&Field<A>>
Return the reference to the payload or body field in a declaration, if present.
sourcepub fn payload_size(&self) -> Option<&Field<A>>
pub fn payload_size(&self) -> Option<&Field<A>>
Return the reference to the payload or body size field in a declaration, if present.
sourcepub fn array_size(&self, id: &str) -> Option<&Field<A>>
pub fn array_size(&self, id: &str) -> Option<&Field<A>>
Return the reference to the array size or count field in a declaration, if present.
pub fn kind(&self) -> &str
Trait Implementations§
source§impl<A: Clone + Annotation> Clone for Decl<A>where
A::DeclAnnotation: Clone,
impl<A: Clone + Annotation> Clone for Decl<A>where A::DeclAnnotation: Clone,
source§impl<A: Debug + Annotation> Debug for Decl<A>where
A::DeclAnnotation: Debug,
impl<A: Debug + Annotation> Debug for Decl<A>where A::DeclAnnotation: Debug,
source§impl<A: Annotation + PartialEq> PartialEq<Decl<A>> for Decl<A>
impl<A: Annotation + PartialEq> PartialEq<Decl<A>> for Decl<A>
impl<A: Annotation + PartialEq> Eq for Decl<A>
Auto Trait Implementations§
impl<A> RefUnwindSafe for Decl<A>where <A as Annotation>::DeclAnnotation: RefUnwindSafe, <A as Annotation>::FieldAnnotation: RefUnwindSafe,
impl<A> Send for Decl<A>where <A as Annotation>::DeclAnnotation: Send, <A as Annotation>::FieldAnnotation: Send,
impl<A> Sync for Decl<A>where <A as Annotation>::DeclAnnotation: Sync, <A as Annotation>::FieldAnnotation: Sync,
impl<A> Unpin for Decl<A>where <A as Annotation>::DeclAnnotation: Unpin, <A as Annotation>::FieldAnnotation: Unpin,
impl<A> UnwindSafe for Decl<A>where <A as Annotation>::DeclAnnotation: UnwindSafe, <A as Annotation>::FieldAnnotation: UnwindSafe,
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