[][src]Trait rkyv::ArchiveRef

pub trait ArchiveRef {
    type Archived: ?Sized;
    type Reference: Deref<Target = Self::Archived>;
    type Resolver: Resolve<Self, Archived = Self::Reference>;
    fn archive_ref<W: Write + ?Sized>(
        &self,
        writer: &mut W
    ) -> Result<Self::Resolver, W::Error>; }

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.

Loading content...

Required methods

fn archive_ref<W: Write + ?Sized>(
    &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.

Loading content...

Implementations on Foreign Types

impl ArchiveRef for str[src]

type Archived = str

type Reference = ArchivedStrRef

type Resolver = usize

impl<T: Archive> ArchiveRef for [T][src]

type Archived = [T::Archived]

type Reference = ArchivedSliceRef<T::Archived>

type Resolver = usize

Loading content...

Implementors

impl<T: Archive> ArchiveRef for T[src]

type Archived = T::Archived

type Reference = RelPtr<Self::Archived>

type Resolver = usize

Loading content...