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: ExpressionA condition expression that evaluates to a boolean value.
true_expr: ExpressionThe expression returned by the conditional if the condition evaluates to true.
false_expr: ExpressionThe 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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.