yoke

Trait CloneableCart

Source
pub unsafe trait CloneableCart: Clone { }
Expand description

This trait marks cart types that do not change source on cloning

This is conceptually similar to stable_deref_trait::CloneStableDeref, however stable_deref_trait::CloneStableDeref is not (and should not) be implemented on Option (since it’s not Deref). CloneableCart essentially is “if there is data to borrow from here, cloning the cart gives you an additional handle to the same data”.

§Safety

This trait is safe to implement on StableDeref types which, once Cloned, point to the same underlying data and retain ownership.

This trait can also be implemented on aggregates of such types like Option<T: CloneableCart> and (T: CloneableCart, U: CloneableCart).

Essentially, all data that could be referenced by a Yokeable (i.e. data that is referenced via a StableDeref) must retain the same pointer and ownership semantics once cloned.

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 CloneableCart for ()

Source§

impl<'a, T: ?Sized> CloneableCart for &'a T

Source§

impl<T: CloneableCart> CloneableCart for Option<T>

Source§

impl<T: ?Sized> CloneableCart for Rc<T>

Source§

impl<T: ?Sized> CloneableCart for Arc<T>

Implementors§