Struct hcl::expr::Conditional
source · 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) -> Conditionalwhere
C: Into<Expression>,
T: Into<Expression>,
F: Into<Expression>,
pub fn new<C, T, F>(cond_expr: C, true_expr: T, false_expr: F) -> Conditionalwhere C: Into<Expression>, T: Into<Expression>, F: Into<Expression>,
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§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
§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<Conditional> for Conditional
impl PartialEq<Conditional> for Conditional
source§fn eq(&self, other: &Conditional) -> bool
fn eq(&self, other: &Conditional) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for Conditional
impl Serialize for Conditional
impl Eq for Conditional
impl StructuralEq for Conditional
impl StructuralPartialEq for Conditional
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.