[−][src]Trait rkyv::ArchiveRef
This trait is a counterpart of Archive
that's suitable for unsized
types. Instead of archiving its value directly, ArchiveRef
archives
a type that dereferences to its archived type. As a consequence, its
Resolver
resolves to a Reference
instead of the archived type.
ArchiveRef
is automatically implemented for all types that implement
Archive
, and uses a RelPtr
as the reference type.
ArchiveRef
is already implemented for slices and string slices. Use
the rkyv_dyn
crate to archive trait objects. Unfortunately, you'll
have to manually implement ArchiveRef
for your other unsized types.
Associated Types
type Archived: ?Sized
The archived version of this type.
type Reference: Deref<Target = Self::Archived>
The reference to the archived version of this type.
type Resolver: Resolve<Self, Archived = Self::Reference>
The resolver for the reference of this type.
Required methods
fn archive_ref<W: Write + ?Sized>(
&self,
writer: &mut W
) -> Result<Self::Resolver, W::Error>
&self,
writer: &mut W
) -> Result<Self::Resolver, W::Error>
Writes the object and returns a resolver that can create the reference to the archived type.
Implementations on Foreign Types
impl ArchiveRef for str
[src]
type Archived = str
type Reference = ArchivedStrRef
type Resolver = usize
fn archive_ref<W: Write + ?Sized>(
&self,
writer: &mut W
) -> Result<Self::Resolver, W::Error>
[src]
&self,
writer: &mut W
) -> Result<Self::Resolver, W::Error>
impl<T: Archive> ArchiveRef for [T]
[src]
type Archived = [T::Archived]
type Reference = ArchivedSliceRef<T::Archived>
type Resolver = usize
fn archive_ref<W: Write + ?Sized>(
&self,
writer: &mut W
) -> Result<Self::Resolver, W::Error>
[src]
&self,
writer: &mut W
) -> Result<Self::Resolver, W::Error>