pub struct Conditional {
pub cond_expr: Expression,
pub true_expr: Expression,
pub false_expr: Expression,
/* private fields */
}
Expand description
The conditional operator allows selecting from one of two expressions based on the outcome of a boolean expression.
Fields§
§cond_expr: Expression
A condition expression that evaluates to a boolean value.
true_expr: Expression
The expression returned by the conditional if the condition evaluates to true
.
false_expr: Expression
The expression returned by the conditional if the condition evaluates to false
.
Implementations§
Source§impl Conditional
impl Conditional
Sourcepub fn new(
cond_expr: impl Into<Expression>,
true_expr: impl Into<Expression>,
false_expr: impl Into<Expression>,
) -> Conditional
pub fn new( cond_expr: impl Into<Expression>, true_expr: impl Into<Expression>, false_expr: impl Into<Expression>, ) -> Conditional
Creates a new Conditional
from a condition and two expressions for the branches of the
conditional.
Trait Implementations§
Source§impl Clone for Conditional
impl Clone for Conditional
Source§fn clone(&self) -> Conditional
fn clone(&self) -> Conditional
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 Conditional
impl Debug for Conditional
Source§impl Decorate for Conditional
impl Decorate for Conditional
Source§impl From<Conditional> for Expression
impl From<Conditional> for Expression
Source§fn from(value: Conditional) -> Self
fn from(value: Conditional) -> Self
Converts to this type from the input type.
Source§impl PartialEq for Conditional
impl PartialEq for Conditional
Source§impl Span for Conditional
impl Span for Conditional
impl Eq for Conditional
Auto Trait Implementations§
impl Freeze for Conditional
impl RefUnwindSafe for Conditional
impl Send for Conditional
impl Sync for Conditional
impl Unpin for Conditional
impl UnwindSafe for Conditional
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