Trait Pooling

Source
pub trait Pooling<E = <Self as Fallible>::Error> {
    // Required methods
    fn start_pooling(&mut self, address: usize) -> PoolingState;
    unsafe fn finish_pooling(
        &mut self,
        address: usize,
        ptr: ErasedPtr,
        drop: unsafe fn(ErasedPtr),
    ) -> Result<(), E>;
}
Expand description

A shared pointer deserialization strategy.

This trait is required to deserialize Rc and Arc.

Required Methods§

Source

fn start_pooling(&mut self, address: usize) -> PoolingState

Starts pooling the value associated with the given address.

Source

unsafe fn finish_pooling( &mut self, address: usize, ptr: ErasedPtr, drop: unsafe fn(ErasedPtr), ) -> Result<(), E>

Finishes pooling the value associated with the given address.

Returns an error if the given address was not pending.

§Safety

The given drop function must be valid to call with ptr.

Implementations on Foreign Types§

Source§

impl<T, E> Pooling<E> for Strategy<T, E>
where T: Pooling<E>,

Source§

fn start_pooling(&mut self, address: usize) -> PoolingState

Source§

unsafe fn finish_pooling( &mut self, address: usize, ptr: ErasedPtr, drop: unsafe fn(ErasedPtr), ) -> Result<(), E>

Implementors§

Source§

impl<E> Pooling<E> for Unpool

Source§

impl<E: Source> Pooling<E> for Pool

Available on crate feature alloc only.