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 luau only.
pub fn generics(&self) -> Option<&GenericDeclaration>
luau only.The generics declared for the function body.
The <T, U> part of function x<T, U>() end
Only available when the “luau” feature flag is enabled.
Sourcepub fn type_specifiers(&self) -> impl Iterator<Item = Option<&TypeSpecifier>>
Available on crate feature luau only.
pub fn type_specifiers(&self) -> impl Iterator<Item = Option<&TypeSpecifier>>
luau 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 “luau” feature flag is enabled.
Sourcepub fn return_type(&self) -> Option<&TypeSpecifier>
Available on crate feature luau only.
pub fn return_type(&self) -> Option<&TypeSpecifier>
luau only.The return type of the function, if one exists. Only available when the “luau” 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 luau only.
pub fn with_generics(self, generics: Option<GenericDeclaration>) -> Self
luau 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 luau only.
pub fn with_type_specifiers( self, type_specifiers: Vec<Option<TypeSpecifier>>, ) -> Self
luau 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 luau only.
pub fn with_return_type(self, return_type: Option<TypeSpecifier>) -> Self
luau 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 more