pub enum BlockBody {
    Multiline(Body),
    Oneline(Box<OnelineBody>),
}
Expand description

Represents an HCL block body.

This can be either a multiline body with zero or more Structures, or a oneline body containing zero or one Attribute.

Variants§

§

Multiline(Body)

A multiline block body with zero or more Structures.

§

Oneline(Box<OnelineBody>)

A oneline block body with zero or one Attributes.

Implementations§

source§

impl BlockBody

source

pub fn is_empty(&self) -> bool

Returns true if the block body contains no structures.

source

pub fn len(&self) -> usize

Returns the number of structures in the block body, also referred to as its ‘length’.

source

pub fn is_multiline(&self) -> bool

Returns true if this is a multiline block body.

source

pub fn is_oneline(&self) -> bool

Returns true if this is a oneline block body.

source

pub fn as_multiline(&self) -> Option<&Body>

If the BlockBody is of variant Multiline, returns a reference to the Body, otherwise None.

source

pub fn as_multiline_mut(&mut self) -> Option<&mut Body>

If the BlockBody is of variant Multiline, returns a mutable reference to the Body, otherwise None.

source

pub fn as_oneline(&self) -> Option<&OnelineBody>

If the BlockBody is of variant Oneline, returns a reference to the OnelineBody, otherwise None.

source

pub fn as_oneline_mut(&mut self) -> Option<&mut OnelineBody>

If the BlockBody is of variant Oneline, returns a mutable reference to the OnelineBody, otherwise None.

source

pub fn iter(&self) -> Iter<'_>

An iterator visiting all body structures in insertion order. The iterator element type is &'a Structure.

source

pub fn iter_mut(&mut self) -> IterMut<'_>

An iterator visiting all body structures in insertion order, with mutable references to the values. The iterator element type is &'a mut Structure.

Trait Implementations§

source§

impl Clone for BlockBody

source§

fn clone(&self) -> BlockBody

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BlockBody

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Body> for BlockBody

source§

fn from(value: Body) -> Self

Converts to this type from the input type.
source§

impl From<OnelineBody> for BlockBody

source§

fn from(value: OnelineBody) -> Self

Converts to this type from the input type.
source§

impl<T> FromIterator<T> for BlockBodywhere T: Into<Structure>,

source§

fn from_iter<I>(iter: I) -> Selfwhere I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
source§

impl<'a> IntoIterator for &'a BlockBody

§

type Item = &'a Structure

The type of the elements being iterated over.
§

type IntoIter = Box<dyn Iterator<Item = &'a Structure> + 'a, Global>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a> IntoIterator for &'a mut BlockBody

§

type Item = &'a mut Structure

The type of the elements being iterated over.
§

type IntoIter = Box<dyn Iterator<Item = &'a mut Structure> + 'a, Global>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoIterator for BlockBody

§

type Item = Structure

The type of the elements being iterated over.
§

type IntoIter = Box<dyn Iterator<Item = Structure> + 'static, Global>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq<BlockBody> for BlockBody

source§

fn eq(&self, other: &BlockBody) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for BlockBody

source§

impl StructuralEq for BlockBody

source§

impl StructuralPartialEq for BlockBody

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.