[−][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
[src]
The archived version of this type.
type Reference: Deref<Target = Self::Archived> + DerefMut<Target = Self::Archived>
[src]
The reference to the archived version of this type.
type Resolver: Resolve<Self, Archived = Self::Reference>
[src]
The resolver for the reference of this type.
Required methods
pub 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>
Writes the object and returns a resolver that can create the reference to the archived type.
Implementations on Foreign Types
impl<T: ArchiveSelf> ArchiveRef for [T]
[src]
pub 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 ArchiveRef for str
[src]
type Archived = str
type Reference = ArchivedStringSlice
type Resolver = usize
pub 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 = ArchivedSlice<T::Archived>
type Resolver = usize
pub default 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>