hcl_edit

Trait Decorate

Source
pub trait Decorate {
    // Required methods
    fn decor(&self) -> &Decor;
    fn decor_mut(&mut self) -> &mut Decor;

    // Provided methods
    fn decorate(&mut self, decor: impl Into<Decor>) { ... }
    fn decorated(self, decor: impl Into<Decor>) -> Self
       where Self: Sized { ... }
}
Expand description

A trait for objects which can be decorated with whitespace and comments.

Required Methods§

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.

Provided Methods§

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> Decorate for Box<T>
where T: Decorate,

Source§

fn decor(&self) -> &Decor

Source§

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

Implementors§