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
sourceimpl 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>
pub fn generics(&self) -> Option<&GenericDeclaration>
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>>
pub fn type_specifiers(&self) -> impl Iterator<Item = Option<&TypeSpecifier>>
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>
pub fn return_type(&self) -> Option<&TypeSpecifier>
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
pub fn with_generics(self, generics: Option<GenericDeclaration>) -> Self
Returns a new FunctionBody with the given generics declaration
sourcepub fn with_type_specifiers(
self,
type_specifiers: Vec<Option<TypeSpecifier>>
) -> Self
pub fn with_type_specifiers(
self,
type_specifiers: Vec<Option<TypeSpecifier>>
) -> Self
Returns a new FunctionBody with the given type specifiers
sourcepub fn with_return_type(self, return_type: Option<TypeSpecifier>) -> Self
pub fn with_return_type(self, return_type: Option<TypeSpecifier>) -> Self
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
sourceimpl Clone for FunctionBody
impl Clone for FunctionBody
sourcefn clone(&self) -> FunctionBody
fn clone(&self) -> FunctionBody
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for FunctionBody
impl Debug for FunctionBody
sourceimpl Default for FunctionBody
impl Default for FunctionBody
sourceimpl<'de> Deserialize<'de> for FunctionBody
impl<'de> Deserialize<'de> for FunctionBody
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for FunctionBody
impl Display for FunctionBody
sourceimpl Node for FunctionBody
impl Node for FunctionBody
sourcefn start_position(&self) -> Option<Position>
fn start_position(&self) -> Option<Position>
The start position of a node. None if can’t be determined
sourcefn end_position(&self) -> Option<Position>
fn end_position(&self) -> Option<Position>
The end position of a node. None if it can’t be determined
sourcefn similar(&self, other: &Self) -> bool
fn similar(&self, other: &Self) -> bool
Whether another node of the same type is the same as this one semantically, ignoring position
sourcefn tokens<'a>(&'a self) -> Tokens<'a>ⓘNotable traits for Tokens<'a>impl<'a> Iterator for Tokens<'a> type Item = &'a TokenReference;
fn tokens<'a>(&'a self) -> Tokens<'a>ⓘNotable traits for Tokens<'a>impl<'a> Iterator for Tokens<'a> type Item = &'a TokenReference;
The token references that comprise a node
sourceimpl PartialEq<FunctionBody> for FunctionBody
impl PartialEq<FunctionBody> for FunctionBody
sourcefn eq(&self, other: &FunctionBody) -> bool
fn eq(&self, other: &FunctionBody) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &FunctionBody) -> bool
fn ne(&self, other: &FunctionBody) -> bool
This method tests for !=
.
sourceimpl Serialize for FunctionBody
impl Serialize for FunctionBody
impl StructuralPartialEq for FunctionBody
Auto Trait Implementations
impl RefUnwindSafe for FunctionBody
impl Send for FunctionBody
impl Sync for FunctionBody
impl Unpin for FunctionBody
impl UnwindSafe for FunctionBody
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more