Struct hcl::structure::BodyBuilder

source ·
pub struct BodyBuilder(_);
Expand description

BodyBuilder builds a HCL Body.

The builder allows to build the Body by adding attributes and other nested blocks via chained method calls. A call to .build() produces the final Body.

Example

use hcl::{Body, Block};

let body = Body::builder()
    .add_block(
        Block::builder("resource")
            .add_label("aws_s3_bucket")
            .add_label("mybucket")
            .add_attribute(("name", "mybucket"))
            .build()
    )
    .build();

Implementations§

Adds an Attribute to the body.

Consumes self and returns a new BodyBuilder.

Adds Attributes to the body from an iterator.

Consumes self and returns a new BodyBuilder.

Adds a Block to the body.

Consumes self and returns a new BodyBuilder.

Adds Blocks to the body from an iterator.

Consumes self and returns a new BodyBuilder.

Adds a Structure to the body.

Consumes self and returns a new BodyBuilder.

Adds Structures to the body from an iterator.

Consumes self and returns a new BodyBuilder.

Consumes self and builds the Body from the structures added via the builder methods.

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.