Struct full_moon::ast::types::IfExpression
source · pub struct IfExpression { /* private fields */ }
Available on crate feature
roblox
only.Expand description
An if statement
Implementations§
source§impl IfExpression
impl IfExpression
sourcepub fn new(
condition: Expression,
if_expression: Expression,
else_expression: Expression
) -> Self
pub fn new( condition: Expression, if_expression: Expression, else_expression: Expression ) -> Self
Creates a new If from the given condition
sourcepub fn if_token(&self) -> &TokenReference
pub fn if_token(&self) -> &TokenReference
The if
token
sourcepub fn condition(&self) -> &Expression
pub fn condition(&self) -> &Expression
The condition of the if expression, condition
in if condition then
sourcepub fn then_token(&self) -> &TokenReference
pub fn then_token(&self) -> &TokenReference
The then
token
sourcepub fn if_expression(&self) -> &Expression
pub fn if_expression(&self) -> &Expression
The expression evaluated if the initial if condition holds
sourcepub fn else_token(&self) -> &TokenReference
pub fn else_token(&self) -> &TokenReference
The else
token
sourcepub fn else_if_expressions(&self) -> Option<&Vec<ElseIfExpression>>
pub fn else_if_expressions(&self) -> Option<&Vec<ElseIfExpression>>
If there are elseif
conditions, returns a vector of them
sourcepub fn else_expression(&self) -> &Expression
pub fn else_expression(&self) -> &Expression
The else expression if all other conditions do not hold
sourcepub fn with_if_token(self, if_token: TokenReference) -> Self
pub fn with_if_token(self, if_token: TokenReference) -> Self
Returns a new IfExpression with the given if
token
sourcepub fn with_condition(self, condition: Expression) -> Self
pub fn with_condition(self, condition: Expression) -> Self
Returns a new IfExpression with the given condition
sourcepub fn with_then_token(self, then_token: TokenReference) -> Self
pub fn with_then_token(self, then_token: TokenReference) -> Self
Returns a new IfExpression with the given then
token
sourcepub fn with_if_expression(self, if_expression: Expression) -> Self
pub fn with_if_expression(self, if_expression: Expression) -> Self
Returns a new IfExpression with the given if expression
sourcepub fn with_else_if(
self,
else_if_expressions: Option<Vec<ElseIfExpression>>
) -> Self
pub fn with_else_if( self, else_if_expressions: Option<Vec<ElseIfExpression>> ) -> Self
Returns a new If with the given list of elseif
expressions
sourcepub fn with_else_token(self, else_token: TokenReference) -> Self
pub fn with_else_token(self, else_token: TokenReference) -> Self
Returns a new IfExpression with the given else
token
sourcepub fn with_else(self, else_expression: Expression) -> Self
pub fn with_else(self, else_expression: Expression) -> Self
Returns a new IfExpression with the given else
expression
Trait Implementations§
source§impl Clone for IfExpression
impl Clone for IfExpression
source§fn clone(&self) -> IfExpression
fn clone(&self) -> IfExpression
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for IfExpression
impl Debug for IfExpression
source§impl<'de> Deserialize<'de> for IfExpression
impl<'de> Deserialize<'de> for IfExpression
source§fn 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
source§impl Display for IfExpression
impl Display for IfExpression
source§impl Node for IfExpression
impl Node for IfExpression
source§fn start_position(&self) -> Option<Position>
fn start_position(&self) -> Option<Position>
The start position of a node. None if can’t be determined
source§fn end_position(&self) -> Option<Position>
fn end_position(&self) -> Option<Position>
The end position of a node. None if it can’t be determined
source§fn 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
source§impl PartialEq for IfExpression
impl PartialEq for IfExpression
source§fn eq(&self, other: &IfExpression) -> bool
fn eq(&self, other: &IfExpression) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for IfExpression
impl Serialize for IfExpression
impl StructuralPartialEq for IfExpression
Auto Trait Implementations§
impl RefUnwindSafe for IfExpression
impl Send for IfExpression
impl Sync for IfExpression
impl Unpin for IfExpression
impl UnwindSafe for IfExpression
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
Mutably borrows from an owned value. Read more