Trait tiptoe::ManagedClone[][src]

pub trait ManagedClone: Sized {
    unsafe fn managed_clone(&self) -> Self;

    unsafe fn managed_clone_from(&mut self, source: &Self) { ... }
}
Expand description

Exactly like Clone but with safety restrictions regarding usage.

See the methods for more information.

Required methods

Safety

This method may only be used to create equally encapsulated instances.

For example, if you can see the instance is inside a Box, then you may clone it into another Box this way.

If you have only a reference or pointer to the implementing type’s instance, but don’t know or can’t replicate its precise encapsulation, then you must not call this method.

You may not use it in any way that could have side-effects before encapsulating the clone. This also means you may not drop the clone. Forgetting it is fine.

Provided methods

Safety

This method may only be used to create equally encapsulated instances.

For example, if you can see the instance is inside a Box, then you may clone it into another Box this way.

If you have only a reference or pointer to the implementing type’s instance, but don’t know or can’t replicate its precise encapsulation, then you must not call this method.

You may not use it in any way that could have side-effects before encapsulating the clone. This also means you may not drop the clone. Forgetting it is fine.

Implementors