pub struct FunctionCall { /* private fields */ }
Expand description
Represents a function call expression (e.g., func()
, obj:method()
, a.b.c()
).
Implementations§
Source§impl FunctionCall
impl FunctionCall
Sourcepub fn new(
prefix: Prefix,
arguments: Arguments,
method: Option<Identifier>,
) -> Self
pub fn new( prefix: Prefix, arguments: Arguments, method: Option<Identifier>, ) -> Self
Creates a new function call with the given prefix, arguments, and optional method.
Sourcepub fn from_name<T: Into<Identifier>>(name: T) -> Self
pub fn from_name<T: Into<Identifier>>(name: T) -> Self
Creates a new function call with the given name.
Sourcepub fn from_prefix<T: Into<Prefix>>(prefix: T) -> Self
pub fn from_prefix<T: Into<Prefix>>(prefix: T) -> Self
Creates a new function call with the given prefix.
Sourcepub fn with_tokens(self, tokens: FunctionCallTokens) -> Self
pub fn with_tokens(self, tokens: FunctionCallTokens) -> Self
Sets the tokens for this function call.
Sourcepub fn set_tokens(&mut self, tokens: FunctionCallTokens)
pub fn set_tokens(&mut self, tokens: FunctionCallTokens)
Sets the tokens for this function call.
Sourcepub fn get_tokens(&self) -> Option<&FunctionCallTokens>
pub fn get_tokens(&self) -> Option<&FunctionCallTokens>
Returns the tokens for this function call, if any.
Sourcepub fn with_arguments<A: Into<Arguments>>(self, arguments: A) -> Self
pub fn with_arguments<A: Into<Arguments>>(self, arguments: A) -> Self
Sets the arguments for this function call.
Sourcepub fn with_argument<T: Into<Expression>>(self, argument: T) -> Self
pub fn with_argument<T: Into<Expression>>(self, argument: T) -> Self
Adds an argument to this function call.
Sourcepub fn with_method<IntoString: Into<Identifier>>(
self,
method: IntoString,
) -> Self
pub fn with_method<IntoString: Into<Identifier>>( self, method: IntoString, ) -> Self
Sets the method name for this function call (for method calls like obj:method()
).
Sourcepub fn get_arguments(&self) -> &Arguments
pub fn get_arguments(&self) -> &Arguments
Returns the arguments of this function call.
Sourcepub fn get_method(&self) -> Option<&Identifier>
pub fn get_method(&self) -> Option<&Identifier>
Returns the method name, if this is a method call.
Sourcepub fn has_method(&self) -> bool
pub fn has_method(&self) -> bool
Returns if this call uses a method.
Sourcepub fn get_prefix(&self) -> &Prefix
pub fn get_prefix(&self) -> &Prefix
Returns the prefix (what is being called) of this function call.
Sourcepub fn take_method(&mut self) -> Option<Identifier>
pub fn take_method(&mut self) -> Option<Identifier>
Removes and returns the method name, if any.
Sourcepub fn set_arguments(&mut self, arguments: Arguments)
pub fn set_arguments(&mut self, arguments: Arguments)
Sets the arguments for this function call.
Sourcepub fn set_method(&mut self, method: Identifier)
pub fn set_method(&mut self, method: Identifier)
Sets the method name for this function call.
Sourcepub fn mutate_arguments(&mut self) -> &mut Arguments
pub fn mutate_arguments(&mut self) -> &mut Arguments
Returns a mutable reference to the arguments.
Sourcepub fn mutate_prefix(&mut self) -> &mut Prefix
pub fn mutate_prefix(&mut self) -> &mut Prefix
Returns a mutable reference to the prefix.
Sourcepub fn mutate_first_token(&mut self) -> &mut Token
pub fn mutate_first_token(&mut self) -> &mut Token
Returns a mutable reference to the first token of this function call, creating it if missing.
Sourcepub fn mutate_last_token(&mut self) -> &mut Token
pub fn mutate_last_token(&mut self) -> &mut Token
Returns a mutable reference to the last token of this function call, creating it if missing.
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 FunctionCall
impl Clone for FunctionCall
Source§fn clone(&self) -> FunctionCall
fn clone(&self) -> FunctionCall
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FunctionCall
impl Debug for FunctionCall
Source§impl From<FunctionCall> for Expression
impl From<FunctionCall> for Expression
Source§fn from(call: FunctionCall) -> Expression
fn from(call: FunctionCall) -> Expression
Source§impl From<FunctionCall> for Prefix
impl From<FunctionCall> for Prefix
Source§fn from(call: FunctionCall) -> Self
fn from(call: FunctionCall) -> Self
Source§impl From<FunctionCall> for Statement
impl From<FunctionCall> for Statement
Source§fn from(call: FunctionCall) -> Statement
fn from(call: FunctionCall) -> Statement
Source§impl PartialEq for FunctionCall
impl PartialEq for FunctionCall
impl Eq for FunctionCall
impl StructuralPartialEq for FunctionCall
Auto Trait Implementations§
impl Freeze for FunctionCall
impl RefUnwindSafe for FunctionCall
impl Send for FunctionCall
impl Sync for FunctionCall
impl Unpin for FunctionCall
impl UnwindSafe for FunctionCall
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