pub struct FunctionName { /* private fields */ }
Expand description
Represents the name portion of a function statement.
Function names can include table fields and methods
([e.g., module.table:method
]).
Implementations§
Source§impl FunctionName
impl FunctionName
Sourcepub fn new(
name: Identifier,
field_names: Vec<Identifier>,
method: Option<Identifier>,
) -> Self
pub fn new( name: Identifier, field_names: Vec<Identifier>, method: Option<Identifier>, ) -> Self
Creates a new function name with fields and an optional method.
Sourcepub fn from_name<S: Into<Identifier>>(name: S) -> Self
pub fn from_name<S: Into<Identifier>>(name: S) -> Self
Creates a new function name from a single identifier.
Sourcepub fn with_tokens(self, tokens: FunctionNameTokens) -> Self
pub fn with_tokens(self, tokens: FunctionNameTokens) -> Self
Sets the tokens for this function name.
Sourcepub fn set_tokens(&mut self, tokens: FunctionNameTokens)
pub fn set_tokens(&mut self, tokens: FunctionNameTokens)
Sets the tokens for this function name.
Sourcepub fn get_tokens(&self) -> Option<&FunctionNameTokens>
pub fn get_tokens(&self) -> Option<&FunctionNameTokens>
Returns the tokens for this function name, if any.
Sourcepub fn with_field<S: Into<Identifier>>(self, field: S) -> Self
pub fn with_field<S: Into<Identifier>>(self, field: S) -> Self
Adds a field to this function name.
Sourcepub fn with_fields(self, field_names: Vec<Identifier>) -> Self
pub fn with_fields(self, field_names: Vec<Identifier>) -> Self
Sets the field names for this function name.
Sourcepub fn with_method<S: Into<Identifier>>(self, method: S) -> Self
pub fn with_method<S: Into<Identifier>>(self, method: S) -> Self
Sets a method for this function name.
Sourcepub fn push_field<S: Into<Identifier>>(&mut self, field: S)
pub fn push_field<S: Into<Identifier>>(&mut self, field: S)
Adds a field to this function name.
Sourcepub fn remove_method(&mut self) -> Option<Identifier>
pub fn remove_method(&mut self) -> Option<Identifier>
Removes and returns the method, if any.
Sourcepub fn get_method(&self) -> Option<&Identifier>
pub fn get_method(&self) -> Option<&Identifier>
Returns the method, if any.
Sourcepub fn has_method(&self) -> bool
pub fn has_method(&self) -> bool
Returns whether this function name has a method component.
Sourcepub fn get_name(&self) -> &Identifier
pub fn get_name(&self) -> &Identifier
Returns the base name.
Sourcepub fn set_name(&mut self, name: Identifier)
pub fn set_name(&mut self, name: Identifier)
Sets the base name.
Sourcepub fn get_field_names(&self) -> &Vec<Identifier>
pub fn get_field_names(&self) -> &Vec<Identifier>
Returns the field names.
Sourcepub fn mutate_identifier(&mut self) -> &mut Identifier
pub fn mutate_identifier(&mut self) -> &mut Identifier
Returns a mutable reference to the base identifier.
Sourcepub fn clear_comments(&mut self)
pub fn clear_comments(&mut self)
Clears all comments from the tokens in this node.
Sourcepub fn clear_whitespaces(&mut self)
pub fn clear_whitespaces(&mut self)
Clears all whitespaces information from the tokens in this node.
Trait Implementations§
Source§impl Clone for FunctionName
impl Clone for FunctionName
Source§fn clone(&self) -> FunctionName
fn clone(&self) -> FunctionName
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FunctionName
impl Debug for FunctionName
Source§impl PartialEq for FunctionName
impl PartialEq for FunctionName
impl Eq for FunctionName
impl StructuralPartialEq for FunctionName
Auto Trait Implementations§
impl Freeze for FunctionName
impl RefUnwindSafe for FunctionName
impl Send for FunctionName
impl Sync for FunctionName
impl Unpin for FunctionName
impl UnwindSafe for FunctionName
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
Source§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more