#[non_exhaustive]pub struct MethodDecl {
pub name: Ident,
pub visibility: Option<Visibility>,
pub is_static: bool,
pub is_abstract: bool,
pub is_final: bool,
pub by_ref: bool,
pub params: Box<[Param]>,
pub return_type: Option<TypeHint>,
pub body: Option<Box<Block>>,
pub attributes: Box<[Attribute]>,
pub doc_comment: Option<Comment>,
}Expand description
A method declaration.
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: IdentMethod name.
visibility: Option<Visibility>Visibility modifier.
is_static: boolWhether static.
is_abstract: boolWhether abstract.
is_final: boolWhether final.
by_ref: boolWhether it returns by reference.
params: Box<[Param]>Parameters.
return_type: Option<TypeHint>Declared return type.
body: Option<Box<Block>>Method body; None for abstract or interface methods.
attributes: Box<[Attribute]>Attributes on the method.
doc_comment: Option<Comment>Preceding doc comment.
Implementations§
Source§impl MethodDecl
impl MethodDecl
Sourcepub fn new(name: Ident) -> Self
pub fn new(name: Ident) -> Self
A method with name set and every other field empty. Set the rest by
assignment; see Param::new.
Trait Implementations§
Source§impl Clone for MethodDecl
impl Clone for MethodDecl
Source§impl Debug for MethodDecl
impl Debug for MethodDecl
Auto Trait Implementations§
impl Freeze for MethodDecl
impl RefUnwindSafe for MethodDecl
impl Send for MethodDecl
impl Sync for MethodDecl
impl Unpin for MethodDecl
impl UnsafeUnpin for MethodDecl
impl UnwindSafe for MethodDecl
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