pub trait SubEnvironment: Sized {
// Required method
fn sub_env(&self) -> Self;
}Expand description
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§
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.