Trait rkyv::de::SharedDeserializeRegistry
source · [−]pub trait SharedDeserializeRegistry: Fallible {
fn get_shared_ptr(&mut self, ptr: *const u8) -> Option<&dyn SharedPointer>;
fn add_shared_ptr(
&mut self,
ptr: *const u8,
shared: Box<dyn SharedPointer>
) -> Result<(), Self::Error>;
fn deserialize_shared<T, P, F, A>(
&mut self,
value: &T::Archived,
to_shared: F,
alloc: A
) -> Result<*const T, Self::Error>
where
T: ArchiveUnsized + ?Sized,
P: SharedPointer + 'static,
F: FnOnce(*mut T) -> P,
A: FnMut(Layout) -> *mut u8,
T::Archived: DeserializeUnsized<T, Self>,
{ ... }
}
Expand description
A registry that tracks deserialized shared memory.
This trait is required to deserialize shared pointers.
Required methods
Gets the data pointer of a previously-deserialized shared pointer.
Adds the data address of a deserialized shared pointer to the registry.
Provided methods
Checks whether the given reference has been deserialized and either uses the existing shared
pointer to it, or deserializes it and converts it to a shared pointer with to_shared
.