Trait conch_runtime::env::SubEnvironment [] [src]

pub trait SubEnvironment: Sized {
    fn sub_env(&self) -> Self;
}

An interface for all environments that can produce another environment, identical to itself, but any changes applied to the sub environment will not be reflected on the parent.

Although this trait is very similar to the Clone trait, it is beneficial for subenvironments to be created as cheaply as possible (in the event that no changes are made to the subenvironment, there is no need for a deep clone), without relying on default Clone implementations or semantics.

It is strongly encouraged for implementors to utilize clone-on-write smart pointers or other mechanisms (e.g. Rc) to ensure creating and mutating sub environments is as cheap as possible.

Required Methods

Create a new sub-environment, which starts out idential to its parent, but any changes on the new environment will not be reflected on the parent.

Implementors