pub trait RClone {
// Required method
fn clone(&self) -> Self;
}Expand description
Adapter trait for std::clone::Clone.
Provides explicit deep copying for R. This is useful when R users need
to create independent copies of Rust objects (which normally use reference
semantics via ExternalPtr).
§Methods
clone()- Create a deep copy of this value
§Example
ⓘ
#[derive(Clone, ExternalPtr)]
struct Buffer { data: Vec<u8> }
#[miniextendr]
impl RClone for Buffer {}In R:
buf1 <- Buffer$new(...)
buf2 <- buf1$clone() # Independent copyRequired 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.