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
sourceimpl Block
impl Block
sourcepub fn new<I, L, B>(identifier: I, labels: L, body: B) -> Blockwhere
I: Into<Identifier>,
L: IntoIterator,
L::Item: Into<BlockLabel>,
B: IntoIterator,
B::Item: Into<Structure>,
pub fn new<I, L, B>(identifier: I, labels: L, body: B) -> Blockwhere
I: Into<Identifier>,
L: IntoIterator,
L::Item: Into<BlockLabel>,
B: IntoIterator,
B::Item: Into<Structure>,
Creates a new Block
from a block identifier, block labels and a block body.
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
sourceimpl<'de> Deserialize<'de> for Block
impl<'de> Deserialize<'de> for Block
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<'de> IntoDeserializer<'de, Error> for Block
impl<'de> IntoDeserializer<'de, Error> for Block
type Deserializer = MapAccessDeserializer<BlockAccess>
type Deserializer = MapAccessDeserializer<BlockAccess>
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.
impl Eq for Block
impl StructuralEq for Block
impl StructuralPartialEq for Block
Auto Trait Implementations
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
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.