pub enum Element {
Literal(Spanned<String>),
Interpolation(Interpolation),
Directive(Directive),
}
Expand description
An element of an HCL template.
Variants§
Literal(Spanned<String>)
A literal sequence of characters to include in the resulting string.
Interpolation(Interpolation)
An interpolation sequence that evaluates an expression (written in the expression sub-language), and converts the result to a string value.
Directive(Directive)
An if
or for
directive that allows for conditional template evaluation.
Implementations§
Source§impl Element
impl Element
Sourcepub fn is_literal(&self) -> bool
pub fn is_literal(&self) -> bool
Returns true
if the element represents a literal string.
Sourcepub fn as_literal(&self) -> Option<&Spanned<String>>
pub fn as_literal(&self) -> Option<&Spanned<String>>
If the Element
is a literal string, returns a reference to it, otherwise None
.
Sourcepub fn is_interpolation(&self) -> bool
pub fn is_interpolation(&self) -> bool
Returns true
if the element represents an interpolation.
Sourcepub fn as_interpolation(&self) -> Option<&Interpolation>
pub fn as_interpolation(&self) -> Option<&Interpolation>
If the Element
is an interpolation, returns a reference to it, otherwise None
.
Sourcepub fn is_directive(&self) -> bool
pub fn is_directive(&self) -> bool
Returns true
if the element represents a directive.
Sourcepub fn as_directive(&self) -> Option<&Directive>
pub fn as_directive(&self) -> Option<&Directive>
If the Element
is a directive, returns a reference to it, otherwise None
.
Trait Implementations§
Source§impl From<Interpolation> for Element
impl From<Interpolation> for Element
Source§fn from(value: Interpolation) -> Self
fn from(value: Interpolation) -> Self
Converts to this type from the input type.
impl Eq for Element
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
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