[go: up one dir, main page]

Sharing

Trait Sharing 

Source
pub trait Sharing<E = <Self as Fallible>::Error> {
    // Required methods
    fn start_sharing(&mut self, address: usize) -> SharingState;
    fn finish_sharing(&mut self, address: usize, pos: usize) -> Result<(), E>;
}
Expand description

A shared pointer serialization strategy.

This trait is required to serialize Rc and Arc.

Required Methods§

Source

fn start_sharing(&mut self, address: usize) -> SharingState

Starts sharing the value associated with the given address.

Source

fn finish_sharing(&mut self, address: usize, pos: usize) -> Result<(), E>

Finishes sharing the value associated with the given address.

Returns an error if the given address was not pending.

Implementations on Foreign Types§

Source§

impl<T, E> Sharing<E> for &mut T
where T: Sharing<E> + ?Sized,

Source§

fn start_sharing(&mut self, address: usize) -> SharingState

Source§

fn finish_sharing(&mut self, address: usize, pos: usize) -> Result<(), E>

Source§

impl<T, E> Sharing<E> for Strategy<T, E>
where T: Sharing<E> + ?Sized,

Source§

fn start_sharing(&mut self, address: usize) -> SharingState

Source§

fn finish_sharing(&mut self, address: usize, pos: usize) -> Result<(), E>

Implementors§

Source§

impl<E> Sharing<E> for Unshare

Source§

impl<E: Source> Sharing<E> for Share

Available on crate feature alloc only.
Source§

impl<W, A, S: Sharing<E>, E> Sharing<E> for Serializer<W, A, S>