Struct rkyv::with::CopyOptimize [−][src]
pub struct CopyOptimize;
Expand description
A wrapper that provides specialized, performant implementations of serialization and deserialization.
This wrapper can be used with containers like Vec
, but care must be taken to ensure that they
contain copy-safe types. Copy-safe types must be trivially copyable (have the same archived and
unarchived representations) and contain no padding bytes. In situations where copying
uninitialized bytes the output is acceptable, this wrapper may be used with containers of types
that contain padding bytes.
Safety
Using this wrapper with containers containing non-copy-safe types may result in undefined behavior.
Example
use rkyv::{Archive, with::CopyOptimize};
#[derive(Archive)]
struct Example {
#[with(CopyOptimize)]
bytes: Vec<u8>,
}
Trait Implementations
type Archived = ArchivedBox<[T::Archived]>
type Archived = ArchivedBox<[T::Archived]>
The archived type of a With<F, Self>
.
type Resolver = BoxResolver<MetadataResolver<[T]>>
type Resolver = BoxResolver<MetadataResolver<[T]>>
The resolver of a With<F, Self>
.
type Archived = ArchivedVec<T::Archived>
type Archived = ArchivedVec<T::Archived>
The archived type of a With<F, Self>
.
type Resolver = VecResolver
type Resolver = VecResolver
The resolver of a With<F, Self>
.
type Archived = ArchivedBox<[T::Archived]>
type Archived = ArchivedBox<[T::Archived]>
The archived type of a With<F, Self>
.
type Resolver = BoxResolver<MetadataResolver<[T]>>
type Resolver = BoxResolver<MetadataResolver<[T]>>
The resolver of a With<F, Self>
.
impl<T, D> DeserializeWith<ArchivedBox<[<T as Archive>::Archived]>, Box<[T], Global>, D> for CopyOptimize where
T: Archive,
T::Archived: Deserialize<T, D>,
D: Fallible + ?Sized,
impl<T, D> DeserializeWith<ArchivedBox<[<T as Archive>::Archived]>, Box<[T], Global>, D> for CopyOptimize where
T: Archive,
T::Archived: Deserialize<T, D>,
D: Fallible + ?Sized,
impl<T, D> DeserializeWith<ArchivedVec<<T as Archive>::Archived>, Vec<T, Global>, D> for CopyOptimize where
T: Archive,
T::Archived: Deserialize<T, D>,
D: Fallible + ?Sized,
impl<T, D> DeserializeWith<ArchivedVec<<T as Archive>::Archived>, Vec<T, Global>, D> for CopyOptimize where
T: Archive,
T::Archived: Deserialize<T, D>,
D: Fallible + ?Sized,
Deserializes the field type F
using the given deserializer.
impl<T, S> SerializeWith<Box<[T], Global>, S> for CopyOptimize where
T: Serialize<S>,
S: Serializer,
impl<T, S> SerializeWith<Box<[T], Global>, S> for CopyOptimize where
T: Serialize<S>,
S: Serializer,
impl<T, S> SerializeWith<Vec<T, Global>, S> for CopyOptimize where
T: Serialize<S>,
S: Serializer,
impl<T, S> SerializeWith<Vec<T, Global>, S> for CopyOptimize where
T: Serialize<S>,
S: Serializer,
impl<'a, T, S> SerializeWith<With<&'a [T], RefAsBox>, S> for CopyOptimize where
T: Serialize<S>,
S: Serializer,
impl<'a, T, S> SerializeWith<With<&'a [T], RefAsBox>, S> for CopyOptimize where
T: Serialize<S>,
S: Serializer,
Auto Trait Implementations
impl RefUnwindSafe for CopyOptimize
impl Send for CopyOptimize
impl Sync for CopyOptimize
impl Unpin for CopyOptimize
impl UnwindSafe for CopyOptimize
Blanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more