pub struct Conditional {
pub cond_expr: Expression,
pub true_expr: Expression,
pub false_expr: Expression,
}
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<C, T, F>(cond_expr: C, true_expr: T, false_expr: F) -> Conditional
pub fn new<C, T, F>(cond_expr: C, true_expr: T, false_expr: F) -> 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<'de> Deserialize<'de> for Conditional
impl<'de> Deserialize<'de> for Conditional
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 Evaluate for Conditional
impl Evaluate for Conditional
Source§fn evaluate(&self, ctx: &Context<'_>) -> EvalResult<Self::Output>
fn evaluate(&self, ctx: &Context<'_>) -> EvalResult<Self::Output>
Recursively evaluates all HCL templates and expressions in the implementing type using the
variables and functions declared in the
Context
. Read moreSource§fn evaluate_in_place(&mut self, ctx: &Context<'_>) -> EvalResult<(), Errors>
fn evaluate_in_place(&mut self, ctx: &Context<'_>) -> EvalResult<(), Errors>
Recursively tries to evaluate all nested expressions in place. Read more
Source§impl Format for Conditional
impl Format for Conditional
Source§fn format<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<()>where
W: Write,
fn format<W>(&self, fmt: &mut Formatter<'_, W>) -> Result<()>where
W: Write,
Formats a HCL structure using a formatter and writes the result to the provided writer. Read more
Source§impl From<Conditional> for Conditional
impl From<Conditional> for Conditional
Source§fn from(value: Conditional) -> Self
fn from(value: Conditional) -> Self
Converts to this type from the input type.
Source§impl From<Conditional> for Conditional
impl From<Conditional> for Conditional
Source§fn from(value: Conditional) -> Self
fn from(value: Conditional) -> Self
Converts to this type from the input type.
Source§impl From<Conditional> for Expression
impl From<Conditional> for Expression
Source§fn from(cond: Conditional) -> Self
fn from(cond: Conditional) -> Self
Converts to this type from the input type.
Source§impl<'de> IntoDeserializer<'de, Error> for Conditional
impl<'de> IntoDeserializer<'de, Error> for Conditional
Source§type Deserializer = MapAccessDeserializer<ConditionalAccess>
type Deserializer = MapAccessDeserializer<ConditionalAccess>
The type of the deserializer being converted into.
Source§fn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Convert this value into a deserializer.
Source§impl PartialEq for Conditional
impl PartialEq for Conditional
Source§impl Serialize for Conditional
impl Serialize for Conditional
impl Eq for Conditional
impl StructuralPartialEq 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
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
Compare self to
key
and return true
if they are equal.