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
sourceimpl 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
sourceimpl Clone for Conditional
impl Clone for Conditional
sourcefn clone(&self) -> Conditional
fn clone(&self) -> Conditional
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for Conditional
impl Debug for Conditional
sourceimpl<'de> Deserialize<'de> for Conditional
impl<'de> Deserialize<'de> for Conditional
sourcefn 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
sourceimpl Evaluate for Conditional
impl Evaluate for Conditional
sourceimpl Format for Conditional
impl Format for Conditional
sourceimpl From<Conditional> for Expression
impl From<Conditional> for Expression
sourcefn from(cond: Conditional) -> Self
fn from(cond: Conditional) -> Self
Converts to this type from the input type.
sourceimpl<'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.
sourcefn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Convert this value into a deserializer.
sourceimpl PartialEq<Conditional> for Conditional
impl PartialEq<Conditional> for Conditional
sourcefn eq(&self, other: &Conditional) -> bool
fn eq(&self, other: &Conditional) -> bool
sourceimpl 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<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,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.