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: StringThe block identifier.
labels: Vec<BlockLabel>Zero or more block labels.
body: BodyRepresents 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<I, B> From<(I, B)> for Block where
I: Into<String>,
B: IntoIterator,
B::Item: Into<Structure>,
impl<I, B> From<(I, B)> for Block where
I: Into<String>,
B: IntoIterator,
B::Item: Into<Structure>,
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more