pub struct Block {
pub identifier: String,
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: String
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) -> Block where
I: Into<String>,
L: IntoIterator,
L::Item: Into<BlockLabel>,
B: IntoIterator,
B::Item: Into<Structure>,
pub fn new<I, L, B>(identifier: I, labels: L, body: B) -> Block where
I: Into<String>,
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) -> BlockBuilder where
I: Into<String>,
pub fn builder<I>(identifier: I) -> BlockBuilder where
I: Into<String>,
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 = BlockDeserializer
type Deserializer = BlockDeserializer
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 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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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