pub trait AltrepSerialize: Sized {
// Required methods
fn serialized_state(&self) -> SEXP;
fn unserialize(state: SEXP) -> Option<Self>;
}Expand description
Trait for ALTREP types that support serialization.
Saving and loading come as a pair: a class that writes its own state must
be able to rebuild itself from it, or readRDS() of a saved vector fails.
That is why the trait needs Sized (and unserialize has no default),
although AltrepExtract accepts unsized views. A type that can’t rebuild
itself, such as a custom DST of runtime length, leaves serialization to R,
which saves an ordinary vector.
Required Methods§
Sourcefn serialized_state(&self) -> SEXP
fn serialized_state(&self) -> SEXP
Convert the ALTREP data to a serializable R object.
Sourcefn unserialize(state: SEXP) -> Option<Self>
fn unserialize(state: SEXP) -> Option<Self>
Reconstruct the ALTREP data from a serialized state.
Return None if the state is invalid or cannot be deserialized.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".