Struct full_moon::ast::FunctionBody
source · pub struct FunctionBody { /* private fields */ }
Expand description
A function body, everything except function x
in function x(a, b, c) call() end
Implementations§
source§impl FunctionBody
impl FunctionBody
sourcepub fn parameters_parentheses(&self) -> &ContainedSpan
pub fn parameters_parentheses(&self) -> &ContainedSpan
The parentheses of the parameters
sourcepub fn parameters(&self) -> &Punctuated<Parameter>
pub fn parameters(&self) -> &Punctuated<Parameter>
Returns the Punctuated
sequence of the parameters for the function declaration
sourcepub fn end_token(&self) -> &TokenReference
pub fn end_token(&self) -> &TokenReference
The end
token
sourcepub fn generics(&self) -> Option<&GenericDeclaration>
Available on crate feature roblox
only.
pub fn generics(&self) -> Option<&GenericDeclaration>
roblox
only.The generics declared for the function body.
The <T, U>
part of function x<T, U>() end
Only available when the “roblox” feature flag is enabled.
sourcepub fn type_specifiers(&self) -> impl Iterator<Item = Option<&TypeSpecifier>>
Available on crate feature roblox
only.
pub fn type_specifiers(&self) -> impl Iterator<Item = Option<&TypeSpecifier>>
roblox
only.The type specifiers of the variables, in the order that they were assigned.
(foo: number, bar, baz: boolean)
returns an iterator containing:
Some(TypeSpecifier(number)), None, Some(TypeSpecifier(boolean))
Only available when the “roblox” feature flag is enabled.
sourcepub fn return_type(&self) -> Option<&TypeSpecifier>
Available on crate feature roblox
only.
pub fn return_type(&self) -> Option<&TypeSpecifier>
roblox
only.The return type of the function, if one exists. Only available when the “roblox” feature flag is enabled.
sourcepub fn with_parameters_parentheses(
self,
parameters_parentheses: ContainedSpan
) -> Self
pub fn with_parameters_parentheses( self, parameters_parentheses: ContainedSpan ) -> Self
Returns a new FunctionBody with the given parentheses for the parameters
sourcepub fn with_parameters(self, parameters: Punctuated<Parameter>) -> Self
pub fn with_parameters(self, parameters: Punctuated<Parameter>) -> Self
Returns a new FunctionBody with the given parameters
sourcepub fn with_generics(self, generics: Option<GenericDeclaration>) -> Self
Available on crate feature roblox
only.
pub fn with_generics(self, generics: Option<GenericDeclaration>) -> Self
roblox
only.Returns a new FunctionBody with the given generics declaration
sourcepub fn with_type_specifiers(
self,
type_specifiers: Vec<Option<TypeSpecifier>>
) -> Self
Available on crate feature roblox
only.
pub fn with_type_specifiers( self, type_specifiers: Vec<Option<TypeSpecifier>> ) -> Self
roblox
only.Returns a new FunctionBody with the given type specifiers
sourcepub fn with_return_type(self, return_type: Option<TypeSpecifier>) -> Self
Available on crate feature roblox
only.
pub fn with_return_type(self, return_type: Option<TypeSpecifier>) -> Self
roblox
only.Returns a new FunctionBody with the given return type
sourcepub fn with_block(self, block: Block) -> Self
pub fn with_block(self, block: Block) -> Self
Returns a new FunctionBody with the given block
sourcepub fn with_end_token(self, end_token: TokenReference) -> Self
pub fn with_end_token(self, end_token: TokenReference) -> Self
Returns a new FunctionBody with the given end
token
Trait Implementations§
source§impl Clone for FunctionBody
impl Clone for FunctionBody
source§fn clone(&self) -> FunctionBody
fn clone(&self) -> FunctionBody
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FunctionBody
impl Debug for FunctionBody
source§impl Default for FunctionBody
impl Default for FunctionBody
source§impl<'de> Deserialize<'de> for FunctionBody
impl<'de> Deserialize<'de> for FunctionBody
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Display for FunctionBody
impl Display for FunctionBody
source§impl Node for FunctionBody
impl Node for FunctionBody
source§fn start_position(&self) -> Option<Position>
fn start_position(&self) -> Option<Position>
source§fn end_position(&self) -> Option<Position>
fn end_position(&self) -> Option<Position>
source§fn similar(&self, other: &Self) -> bool
fn similar(&self, other: &Self) -> bool
source§impl PartialEq for FunctionBody
impl PartialEq for FunctionBody
source§fn eq(&self, other: &FunctionBody) -> bool
fn eq(&self, other: &FunctionBody) -> bool
self
and other
values to be equal, and is used
by ==
.