#[non_exhaustive]pub struct MethodDecl<'arena, 'src> {
pub name: Ident<'src>,
pub modifiers: Modifiers,
pub by_ref: bool,
pub params: ArenaVec<'arena, Param<'arena, 'src>>,
pub return_type: Option<TypeHint<'arena, 'src>>,
pub body: Option<&'arena Block<'arena, 'src>>,
pub attributes: ArenaVec<'arena, Attribute<'arena, 'src>>,
pub doc_comment: Option<Comment<'src>>,
}Expand description
A method declaration inside a class-like body.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: Ident<'src>Method name.
modifiers: ModifiersVisibility, static, final, abstract and readonly modifiers.
by_ref: booltrue when by reference (&).
params: ArenaVec<'arena, Param<'arena, 'src>>Declared parameters.
return_type: Option<TypeHint<'arena, 'src>>Declared return type, if any.
body: Option<&'arena Block<'arena, 'src>>None for an abstract/interface method.
attributes: ArenaVec<'arena, Attribute<'arena, 'src>>#[...] attributes applied to this node.
doc_comment: Option<Comment<'src>>Preceding /** */ doc-block, if any.
Implementations§
Source§impl<'arena, 'src> MethodDecl<'arena, 'src>
impl<'arena, 'src> MethodDecl<'arena, 'src>
Sourcepub fn new(arena: &'arena Bump, name: Ident<'src>) -> Self
pub fn new(arena: &'arena Bump, name: Ident<'src>) -> Self
A method with name set and every other field empty (no modifiers,
parameters, return type, body or attributes). Set the rest by
assignment; see Param::new.
Trait Implementations§
Source§impl<'arena, 'src> Debug for MethodDecl<'arena, 'src>
impl<'arena, 'src> Debug for MethodDecl<'arena, 'src>
Auto Trait Implementations§
impl<'arena, 'src> !RefUnwindSafe for MethodDecl<'arena, 'src>
impl<'arena, 'src> !Send for MethodDecl<'arena, 'src>
impl<'arena, 'src> !Sync for MethodDecl<'arena, 'src>
impl<'arena, 'src> !UnwindSafe for MethodDecl<'arena, 'src>
impl<'arena, 'src> Freeze for MethodDecl<'arena, 'src>
impl<'arena, 'src> Unpin for MethodDecl<'arena, 'src>
impl<'arena, 'src> UnsafeUnpin for MethodDecl<'arena, 'src>
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