Struct AstDeclarator
pub struct AstDeclarator {
pub kind: AstDeclaratorKind,
pub loc: SourceLocation,
}Expand description
A parsed declarator.
Declarators are parsed inside-out due to recursive descent parsing. Call AstDeclarator::get_derived_kind to get the derived kind, which is probably what you want when interpreting the declarator.
// Source // AstDeclarator layout // AstDeclarator::get_derived_kind
int ** get_ptr(void); Pointer{Pointer{Function{Ident}}} Function
int (*fn)(void); Function{Pointer{Ident}} PointerFields§
§kind: AstDeclaratorKindThe kind of declarator. You probably want AstDeclarator::get_derived_kind instead.
loc: SourceLocationImplementations§
§impl AstDeclarator
impl AstDeclarator
pub fn new(kind: AstDeclaratorKind, loc: SourceLocation) -> Self
pub fn new(kind: AstDeclaratorKind, loc: SourceLocation) -> Self
Makes a new AstDeclarator
pub fn get_derived_kind(&self) -> &AstDeclaratorKind
pub fn get_derived_kind(&self) -> &AstDeclaratorKind
Gets the derived kind of the declarator. You probably want this instead of AstDeclarator::kind.
pub fn get_identifier(&self) -> Option<&AstIdentifier>
pub fn get_identifier(&self) -> Option<&AstIdentifier>
Gets the identifier if the declarator has one, or returns None.
pub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Is this declarator a function declarator?
pub fn is_abstract_array(&self) -> bool
pub fn is_abstract_array(&self) -> bool
Is this declarator an abstract array? (Array with no identifier like ‘[]’ or ‘[3]’).
Trait Implementations§
§impl Clone for AstDeclarator
impl Clone for AstDeclarator
§fn clone(&self) -> AstDeclarator
fn clone(&self) -> AstDeclarator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for AstDeclarator
impl Debug for AstDeclarator
§impl Display for AstDeclarator
impl Display for AstDeclarator
§impl PartialEq for AstDeclarator
impl PartialEq for AstDeclarator
impl StructuralPartialEq for AstDeclarator
Auto Trait Implementations§
impl Freeze for AstDeclarator
impl RefUnwindSafe for AstDeclarator
impl Send for AstDeclarator
impl Sync for AstDeclarator
impl Unpin for AstDeclarator
impl UnwindSafe for AstDeclarator
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