Trait rkyv::ser::SharingExt

source ·
pub trait SharingExt<E>: Sharing<E> {
    // Provided methods
    fn get_shared<T: ?Sized>(&self, value: &T) -> Option<usize> { ... }
    fn add_shared<T: ?Sized>(&mut self, value: &T, pos: usize) -> Result<(), E> { ... }
    fn serialize_shared<T: SerializeUnsized<Self> + ?Sized>(
        &mut self,
        value: &T
    ) -> Result<usize, <Self as Fallible>::Error>
       where Self: Fallible<Error = E> { ... }
}
Expand description

TODO: Document this

Provided Methods§

source

fn get_shared<T: ?Sized>(&self, value: &T) -> Option<usize>

Gets the position of a previously-added shared value.

Returns None if the value has not yet been added.

source

fn add_shared<T: ?Sized>(&mut self, value: &T, pos: usize) -> Result<(), E>

Adds the position of a shared value to the registry.

source

fn serialize_shared<T: SerializeUnsized<Self> + ?Sized>( &mut self, value: &T ) -> Result<usize, <Self as Fallible>::Error>
where Self: Fallible<Error = E>,

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.

Implementors§

source§

impl<S, E> SharingExt<E> for S
where S: Sharing<E> + ?Sized,