pub struct CompoundAssignStatement { /* private fields */ }
Expand description
Represents a compound assignment statement (e.g., a += 1
).
Implementations§
Source§impl CompoundAssignStatement
impl CompoundAssignStatement
Sourcepub fn new<V: Into<Variable>, E: Into<Expression>>(
operator: CompoundOperator,
variable: V,
value: E,
) -> Self
pub fn new<V: Into<Variable>, E: Into<Expression>>( operator: CompoundOperator, variable: V, value: E, ) -> Self
Creates a new compound assignment statement.
Sourcepub fn with_tokens(self, tokens: CompoundAssignTokens) -> Self
pub fn with_tokens(self, tokens: CompoundAssignTokens) -> Self
Sets the tokens for this compound assignment statement.
Sourcepub fn set_tokens(&mut self, tokens: CompoundAssignTokens)
pub fn set_tokens(&mut self, tokens: CompoundAssignTokens)
Sets the tokens for this compound assignment statement.
Sourcepub fn get_tokens(&self) -> Option<&CompoundAssignTokens>
pub fn get_tokens(&self) -> Option<&CompoundAssignTokens>
Returns the tokens for this compound assignment statement, if any.
Sourcepub fn get_operator(&self) -> CompoundOperator
pub fn get_operator(&self) -> CompoundOperator
Returns the compound operator used in this statement.
Sourcepub fn get_variable(&self) -> &Variable
pub fn get_variable(&self) -> &Variable
Returns the variable being assigned to.
Sourcepub fn get_value(&self) -> &Expression
pub fn get_value(&self) -> &Expression
Returns the value expression in the assignment.
Sourcepub fn extract_assignment(self) -> (Variable, Expression)
pub fn extract_assignment(self) -> (Variable, Expression)
Extracts the variable and value from this statement.
Sourcepub fn mutate_variable(&mut self) -> &mut Variable
pub fn mutate_variable(&mut self) -> &mut Variable
Returns a mutable reference to the variable.
Sourcepub fn mutate_value(&mut self) -> &mut Expression
pub fn mutate_value(&mut self) -> &mut Expression
Returns a mutable reference to the value expression.
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 for this statement, 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 for this statement, 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 CompoundAssignStatement
impl Clone for CompoundAssignStatement
Source§fn clone(&self) -> CompoundAssignStatement
fn clone(&self) -> CompoundAssignStatement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CompoundAssignStatement
impl Debug for CompoundAssignStatement
Source§impl From<CompoundAssignStatement> for Statement
impl From<CompoundAssignStatement> for Statement
Source§fn from(statement: CompoundAssignStatement) -> Statement
fn from(statement: CompoundAssignStatement) -> Statement
Source§impl PartialEq for CompoundAssignStatement
impl PartialEq for CompoundAssignStatement
impl Eq for CompoundAssignStatement
impl StructuralPartialEq for CompoundAssignStatement
Auto Trait Implementations§
impl Freeze for CompoundAssignStatement
impl RefUnwindSafe for CompoundAssignStatement
impl Send for CompoundAssignStatement
impl Sync for CompoundAssignStatement
impl Unpin for CompoundAssignStatement
impl UnwindSafe for CompoundAssignStatement
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