Struct rkyv::with::Map

source ·
pub struct Map<Archivable> { /* private fields */ }
Expand description

A generic wrapper that allows wrapping an Option<T>.

Example

use rkyv::{Archive, with::{Map, RefAsBox}};

#[derive(Archive)]
struct Example<'a> {
    #[with(Map<RefAsBox>)]
    option: Option<&'a i32>,
    #[with(Map<RefAsBox>)]
    vec: Vec<&'a i32>,
}

Trait Implementations§

source§

impl<A, O> ArchiveWith<Option<O>> for Map<A>
where A: ArchiveWith<O>,

§

type Archived = ArchivedOption<<A as ArchiveWith<O>>::Archived>

The archived type of a With<F, Self>.
§

type Resolver = Option<<A as ArchiveWith<O>>::Resolver>

The resolver of a With<F, Self>.
source§

unsafe fn resolve_with( field: &Option<O>, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

Resolves the archived type using a reference to the field type F. Read more
source§

impl<A, O> ArchiveWith<Vec<O>> for Map<A>
where A: ArchiveWith<O>,

§

type Archived = ArchivedVec<<A as ArchiveWith<O>>::Archived>

The archived type of a With<F, Self>.
§

type Resolver = VecResolver

The resolver of a With<F, Self>.
source§

unsafe fn resolve_with( field: &Vec<O>, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

Resolves the archived type using a reference to the field type F. Read more
source§

impl<Archivable: Debug> Debug for Map<Archivable>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<A, O, D> DeserializeWith<ArchivedOption<<A as ArchiveWith<O>>::Archived>, Option<O>, D> for Map<A>
where D: Fallible + ?Sized, A: ArchiveWith<O> + DeserializeWith<<A as ArchiveWith<O>>::Archived, O, D>,

source§

fn deserialize_with( field: &ArchivedOption<<A as ArchiveWith<O>>::Archived>, d: &mut D ) -> Result<Option<O>, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<A, O, D> DeserializeWith<ArchivedVec<<A as ArchiveWith<O>>::Archived>, Vec<O>, D> for Map<A>
where A: ArchiveWith<O> + DeserializeWith<<A as ArchiveWith<O>>::Archived, O, D>, D: Fallible + ?Sized,

source§

fn deserialize_with( field: &ArchivedVec<<A as ArchiveWith<O>>::Archived>, d: &mut D ) -> Result<Vec<O>, D::Error>

Deserializes the field type F using the given deserializer.
source§

impl<A, O, S> SerializeWith<Option<O>, S> for Map<A>
where S: Fallible + ?Sized, A: ArchiveWith<O> + SerializeWith<O, S>,

source§

fn serialize_with( field: &Option<O>, s: &mut S ) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.
source§

impl<A, O, S> SerializeWith<Vec<O>, S> for Map<A>

source§

fn serialize_with(field: &Vec<O>, s: &mut S) -> Result<Self::Resolver, S::Error>

Serializes the field type F using the given serializer.

Auto Trait Implementations§

§

impl<Archivable> RefUnwindSafe for Map<Archivable>
where Archivable: RefUnwindSafe,

§

impl<Archivable> Send for Map<Archivable>
where Archivable: Send,

§

impl<Archivable> Sync for Map<Archivable>
where Archivable: Sync,

§

impl<Archivable> Unpin for Map<Archivable>
where Archivable: Unpin,

§

impl<Archivable> UnwindSafe for Map<Archivable>
where Archivable: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.