Trait rkyv::ser::SharedSerializeRegistry
source · pub trait SharedSerializeRegistry: Fallible {
// Required methods
fn get_shared_ptr(&self, value: *const u8) -> Option<usize>;
fn add_shared_ptr(
&mut self,
value: *const u8,
pos: usize,
) -> Result<(), Self::Error>;
// Provided methods
fn get_shared<T: ?Sized>(&self, value: &T) -> Option<usize> { ... }
fn add_shared<T: ?Sized>(
&mut self,
value: &T,
pos: usize,
) -> Result<(), Self::Error> { ... }
fn serialize_shared<T: SerializeUnsized<Self> + ?Sized>(
&mut self,
value: &T,
) -> Result<usize, Self::Error>
where Self: Serializer { ... }
}
Expand description
A registry that tracks serialized shared memory.
This trait is required to serialize shared pointers.
Required Methods§
Gets the position of a previously-added shared pointer.
Returns None
if the pointer has not yet been added.
Adds the position of a shared pointer to the registry.
Provided Methods§
Gets the position of a previously-added shared value.
Returns None
if the value has not yet been added.
Adds the position of a shared value to the registry.
Archives the given shared value and returns its position. If the value has already been added then it returns the position of the previously added value.
Object Safety§
This trait is not object safe.