hcl_edit::structure

Struct StructureMut

Source
pub struct StructureMut<'a> { /* private fields */ }
Expand description

Allows mutable access to a structure, except for attribute keys which are immutable.

This type wraps the structure in the iterator returned by Body::iter_mut.

Implementations§

Source§

impl<'a> StructureMut<'a>

Source

pub fn is_attribute(&self) -> bool

Returns true if the structure represents an Attribute.

Source

pub fn is_block(&self) -> bool

Returns true if the structure represents a Block.

Source

pub fn as_attribute(&self) -> Option<&Attribute>

If the Structure is an Attribute, returns a reference to it, otherwise None.

Source

pub fn as_attribute_mut(&mut self) -> Option<AttributeMut<'_>>

If the Structure is an Attribute, returns a mutable reference to it, otherwise None.

Source

pub fn as_block(&self) -> Option<&Block>

If the Structure is a Block, returns a reference to it, otherwise None.

Source

pub fn as_block_mut(&mut self) -> Option<&mut Block>

If the Structure is a Block, returns a mutable reference to it, otherwise None.

Trait Implementations§

Source§

impl<'a> Decorate for StructureMut<'a>

Source§

fn decor(&self) -> &Decor

Returns a reference to the object’s Decor.
Source§

fn decor_mut(&mut self) -> &mut Decor

Returns a mutable reference to the object’s Decor.
Source§

fn decorate(&mut self, decor: impl Into<Decor>)

Decorate the object with decor in-place.
Source§

fn decorated(self, decor: impl Into<Decor>) -> Self
where Self: Sized,

Decorate the object with decor and return the modified value.
Source§

impl<'a> Span for StructureMut<'a>

Source§

fn span(&self) -> Option<Range<usize>>

Obtains the span information. This only returns Some if the value was emitted by the parser. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for StructureMut<'a>

§

impl<'a> RefUnwindSafe for StructureMut<'a>

§

impl<'a> Send for StructureMut<'a>

§

impl<'a> Sync for StructureMut<'a>

§

impl<'a> Unpin for StructureMut<'a>

§

impl<'a> !UnwindSafe for StructureMut<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.