Skip to main content

ShallowCopy

Trait ShallowCopy 

Source
pub trait ShallowCopy {
    // Required method
    fn shallow_copy(&self) -> Self;
}
Expand description

A copy of an object’s own fields under a fresh object header, which __ffi_shallow_copy__ returns; fields that are references share their objects, as Clone of an Arc does.

rs_object and #[object(rs_parent)] on derive(Object) implement it by copying the parent with its ShallowCopy and cloning every other field. An rs_object needs its parent’s object to implement it.

Required Methods§

Source

fn shallow_copy(&self) -> Self

The copy, under a fresh object header.

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.

Implementors§