pub struct Block {
pub identifier: Identifier,
pub labels: Vec<BlockLabel>,
pub body: Body,
}
Expand description
Represents an HCL block which consists of a block identifier, zero or more block labels and a block body.
In HCL syntax this is represented as:
block_identifier "block_label1" "block_label2" {
body
}
Fields§
§identifier: Identifier
The block identifier.
labels: Vec<BlockLabel>
Zero or more block labels.
body: Body
Represents the Block
’s body.
Implementations§
Source§impl Block
impl Block
Sourcepub fn new<I>(ident: I) -> Blockwhere
I: Into<Identifier>,
pub fn new<I>(ident: I) -> Blockwhere
I: Into<Identifier>,
Creates a new empty Block
.
Sourcepub fn builder<I>(identifier: I) -> BlockBuilderwhere
I: Into<Identifier>,
pub fn builder<I>(identifier: I) -> BlockBuilderwhere
I: Into<Identifier>,
Creates a new BlockBuilder
to start building a new Block
with the provided
identifier.
Sourcepub fn identifier(&self) -> &str
pub fn identifier(&self) -> &str
Returns a reference to the block’s identifier.
Sourcepub fn labels(&self) -> &[BlockLabel]
pub fn labels(&self) -> &[BlockLabel]
Returns a reference to the block’s labels.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Block
impl<'de> Deserialize<'de> for Block
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 Block
impl Evaluate for Block
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 Block
impl Format for Block
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<I, L, B> From<(I, L, B)> for Blockwhere
I: Into<Identifier>,
L: IntoIterator,
L::Item: Into<BlockLabel>,
B: IntoIterator,
B::Item: Into<Structure>,
impl<I, L, B> From<(I, L, B)> for Blockwhere
I: Into<Identifier>,
L: IntoIterator,
L::Item: Into<BlockLabel>,
B: IntoIterator,
B::Item: Into<Structure>,
Source§impl<'de> IntoDeserializer<'de, Error> for Block
impl<'de> IntoDeserializer<'de, Error> for Block
Source§type Deserializer = MapAccessDeserializer<BlockAccess>
type Deserializer = MapAccessDeserializer<BlockAccess>
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.
impl Eq for Block
impl StructuralPartialEq for Block
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
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.