Trait rkyv::de::SharedDeserializeRegistry

source ·
pub trait SharedDeserializeRegistry: Fallible {
    // Required methods
    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>;

    // Provided method
    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§

source

fn get_shared_ptr(&mut self, ptr: *const u8) -> Option<&dyn SharedPointer>

Gets the data pointer of a previously-deserialized shared pointer.

source

fn add_shared_ptr( &mut self, ptr: *const u8, shared: Box<dyn SharedPointer>, ) -> Result<(), Self::Error>

Adds the data address of a deserialized shared pointer to the registry.

Provided Methods§

source

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>,

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.

Object Safety§

This trait is not object safe.

Implementors§