Trait rkyv::Archive

source ·
pub trait Archive {
    type Archived;
    type Resolver;

    // Required method
    unsafe fn resolve(
        &self,
        pos: usize,
        resolver: Self::Resolver,
        out: *mut Self::Archived
    );
}
Expand description

A type that can be used without deserializing.

Archive is one of three basic traits used to work with zero-copy data and controls the layout of the data in its archived zero-copy representation. The Serialize trait helps transform types into that representation, and the Deserialize trait helps transform types back out.

Types that implement Archive must have a well-defined archived size. Unsized types can be supported using the ArchiveUnsized trait, along with SerializeUnsized and DeserializeUnsized.

Archiving is done depth-first, writing any data owned by a type before writing the data for the type itself. The type must be able to create the archived type from only its own data and its resolver.

Archived data is always treated as if it is tree-shaped, with the root owning its direct descendents and so on. Data that is not tree-shaped can be supported using special serializer and deserializer bounds (see ArchivedRc for example). In a buffer of serialized data, objects are laid out in reverse order. This means that the root object is located near the end of the buffer and leaf objects are located near the beginning.

Examples

Most of the time, #[derive(Archive)] will create an acceptable implementation. You can use the #[archive(...)] and #[archive_attr(...)] attributes to control how the implementation is generated. See the Archive derive macro for more details.

use rkyv::{Archive, Deserialize, Serialize};

#[derive(Archive, Deserialize, Serialize, Debug, PartialEq)]
// This will generate a PartialEq impl between our unarchived and archived types
#[archive(compare(PartialEq))]
// We can pass attributes through to generated types with archive_attr
#[archive_attr(derive(Debug))]
struct Test {
    int: u8,
    string: String,
    option: Option<Vec<i32>>,
}

let value = Test {
    int: 42,
    string: "hello world".to_string(),
    option: Some(vec![1, 2, 3, 4]),
};

// Serializing is as easy as a single function call
let bytes = rkyv::to_bytes::<_, 256>(&value).unwrap();

// Or you can customize your serialization for better performance
// and compatibility with #![no_std] environments
use rkyv::ser::{Serializer, serializers::AllocSerializer};

let mut serializer = AllocSerializer::<0>::default();
serializer.serialize_value(&value).unwrap();
let bytes = serializer.into_serializer().into_inner();

// You can use the safe API with the validation feature turned on,
// or you can use the unsafe API (shown here) for maximum performance
let archived = unsafe { rkyv::archived_root::<Test>(&bytes[..]) };
assert_eq!(archived, &value);

// And you can always deserialize back to the original type
let deserialized: Test = archived.deserialize(&mut rkyv::Infallible).unwrap();
assert_eq!(deserialized, value);

Note: the safe API requires the validation feature.

Many of the core and standard library types already have Archive implementations available, but you may need to implement Archive for your own types in some cases the derive macro cannot handle.

In this example, we add our own wrapper that serializes a &'static str as if it’s owned. Normally you can lean on the archived version of String to do most of the work, or use the Inline to do exactly this. This example does everything to demonstrate how to implement Archive for your own types.

use core::{slice, str};
use rkyv::{
    archived_root,
    ser::{Serializer, serializers::AlignedSerializer},
    out_field,
    AlignedVec,
    Archive,
    Archived,
    ArchiveUnsized,
    MetadataResolver,
    RelPtr,
    Serialize,
    SerializeUnsized,
};

struct OwnedStr {
    inner: &'static str,
}

struct ArchivedOwnedStr {
    // This will be a relative pointer to our string
    ptr: RelPtr<str>,
}

impl ArchivedOwnedStr {
    // This will help us get the bytes of our type as a str again.
    fn as_str(&self) -> &str {
        unsafe {
            // The as_ptr() function of RelPtr will get a pointer the str
            &*self.ptr.as_ptr()
        }
    }
}

struct OwnedStrResolver {
    // This will be the position that the bytes of our string are stored at.
    // We'll use this to resolve the relative pointer of our
    // ArchivedOwnedStr.
    pos: usize,
    // The archived metadata for our str may also need a resolver.
    metadata_resolver: MetadataResolver<str>,
}

// The Archive implementation defines the archived version of our type and
// determines how to turn the resolver into the archived form. The Serialize
// implementations determine how to make a resolver from the original value.
impl Archive for OwnedStr {
    type Archived = ArchivedOwnedStr;
    // This is the resolver we can create our Archived version from.
    type Resolver = OwnedStrResolver;

    // The resolve function consumes the resolver and produces the archived
    // value at the given position.
    unsafe fn resolve(
        &self,
        pos: usize,
        resolver: Self::Resolver,
        out: *mut Self::Archived,
    ) {
        // We have to be careful to add the offset of the ptr field,
        // otherwise we'll be using the position of the ArchivedOwnedStr
        // instead of the position of the relative pointer.
        let (fp, fo) = out_field!(out.ptr);
        self.inner.resolve_unsized(
            pos + fp,
            resolver.pos,
            resolver.metadata_resolver,
            fo,
        );
    }
}

// We restrict our serializer types with Serializer because we need its
// capabilities to archive our type. For other types, we might need more or
// less restrictive bounds on the type of S.
impl<S: Serializer + ?Sized> Serialize<S> for OwnedStr {
    fn serialize(
        &self,
        serializer: &mut S
    ) -> Result<Self::Resolver, S::Error> {
        // This is where we want to write the bytes of our string and return
        // a resolver that knows where those bytes were written.
        // We also need to serialize the metadata for our str.
        Ok(OwnedStrResolver {
            pos: self.inner.serialize_unsized(serializer)?,
            metadata_resolver: self.inner.serialize_metadata(serializer)?
        })
    }
}

let mut serializer = AlignedSerializer::new(AlignedVec::new());
const STR_VAL: &'static str = "I'm in an OwnedStr!";
let value = OwnedStr { inner: STR_VAL };
// It works!
serializer.serialize_value(&value).expect("failed to archive test");
let buf = serializer.into_inner();
let archived = unsafe { archived_root::<OwnedStr>(buf.as_ref()) };
// Let's make sure our data got written correctly
assert_eq!(archived.as_str(), STR_VAL);

Required Associated Types§

source

type Archived

The archived representation of this type.

In this form, the data can be used with zero-copy deserialization.

source

type Resolver

The resolver for this type. It must contain all the additional information from serializing needed to make the archived type from the normal type.

Required Methods§

source

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

Creates the archived version of this value at the given position and writes it to the given output.

The output should be initialized field-by-field rather than by writing a whole struct. Performing a typed copy will mark all of the padding bytes as uninitialized, but they must remain set to the value they currently have. This prevents leaking uninitialized memory to the final archive.

Safety
  • pos must be the position of out within the archive
  • resolver must be the result of serializing this object

Implementations on Foreign Types§

source§

impl<T5: Archive, T4: Archive, T3: Archive, T2: Archive, T1: Archive, T0: Archive> Archive for (T5, T4, T3, T2, T1, T0)

§

type Archived = (<T5 as Archive>::Archived, <T4 as Archive>::Archived, <T3 as Archive>::Archived, <T2 as Archive>::Archived, <T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T5 as Archive>::Resolver, <T4 as Archive>::Resolver, <T3 as Archive>::Resolver, <T2 as Archive>::Resolver, <T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T: Archive> Archive for ManuallyDrop<T>

§

type Archived = ManuallyDrop<<T as Archive>::Archived>

§

type Resolver = <T as Archive>::Resolver

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<K: Archive + Hash + Eq, S> Archive for HashSet<K, S>where K::Archived: Hash + Eq,

§

type Archived = ArchivedHashSet<<K as Archive>::Archived>

§

type Resolver = HashSetResolver

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T: Archive> Archive for Option<T>

§

type Archived = ArchivedOption<<T as Archive>::Archived>

§

type Resolver = Option<<T as Archive>::Resolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for NonZeroI64_be

§

type Archived = BigEndian<NonZeroI64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicU16_le

§

type Archived = LittleEndian<u16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for u16_le

§

type Archived = LittleEndian<u16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU16_le

§

type Archived = LittleEndian<NonZeroU16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for SocketAddrV6

§

type Archived = ArchivedSocketAddrV6

§

type Resolver = ()

source§

unsafe fn resolve( &self, pos: usize, _: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for SocketAddr

§

type Archived = ArchivedSocketAddr

§

type Resolver = ()

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T10: Archive, T9: Archive, T8: Archive, T7: Archive, T6: Archive, T5: Archive, T4: Archive, T3: Archive, T2: Archive, T1: Archive, T0: Archive> Archive for (T10, T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)

§

type Archived = (<T10 as Archive>::Archived, <T9 as Archive>::Archived, <T8 as Archive>::Archived, <T7 as Archive>::Archived, <T6 as Archive>::Archived, <T5 as Archive>::Archived, <T4 as Archive>::Archived, <T3 as Archive>::Archived, <T2 as Archive>::Archived, <T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T10 as Archive>::Resolver, <T9 as Archive>::Resolver, <T8 as Archive>::Resolver, <T7 as Archive>::Resolver, <T6 as Archive>::Resolver, <T5 as Archive>::Resolver, <T4 as Archive>::Resolver, <T3 as Archive>::Resolver, <T2 as Archive>::Resolver, <T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for NonZeroI16_be

§

type Archived = BigEndian<NonZeroI16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T3: Archive, T2: Archive, T1: Archive, T0: Archive> Archive for (T3, T2, T1, T0)

§

type Archived = (<T3 as Archive>::Archived, <T2 as Archive>::Archived, <T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T3 as Archive>::Resolver, <T2 as Archive>::Resolver, <T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T: Archive> Archive for RangeToInclusive<T>

§

type Archived = ArchivedRangeToInclusive<<T as Archive>::Archived>

§

type Resolver = RangeToInclusive<<T as Archive>::Resolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T8: Archive, T7: Archive, T6: Archive, T5: Archive, T4: Archive, T3: Archive, T2: Archive, T1: Archive, T0: Archive> Archive for (T8, T7, T6, T5, T4, T3, T2, T1, T0)

§

type Archived = (<T8 as Archive>::Archived, <T7 as Archive>::Archived, <T6 as Archive>::Archived, <T5 as Archive>::Archived, <T4 as Archive>::Archived, <T3 as Archive>::Archived, <T2 as Archive>::Archived, <T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T8 as Archive>::Resolver, <T7 as Archive>::Resolver, <T6 as Archive>::Resolver, <T5 as Archive>::Resolver, <T4 as Archive>::Resolver, <T3 as Archive>::Resolver, <T2 as Archive>::Resolver, <T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T: ArchiveUnsized + ?Sized> Archive for Box<T>

§

type Archived = ArchivedBox<<T as ArchiveUnsized>::Archived>

§

type Resolver = BoxResolver<<T as ArchiveUnsized>::MetadataResolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T: ArchiveUnsized + ?Sized> Archive for Rc<T>

§

type Archived = ArchivedRc<<T as ArchiveUnsized>::Archived, RcFlavor>

§

type Resolver = RcResolver<<T as ArchiveUnsized>::MetadataResolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for u32

§

type Archived = u32

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU32_be

§

type Archived = BigEndian<NonZeroU32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i32

§

type Archived = i32

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroI32_be

§

type Archived = BigEndian<NonZeroI32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicI32_be

§

type Archived = BigEndian<i32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for u64

§

type Archived = u64

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i128

§

type Archived = i128

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T: ArchiveUnsized + ?Sized> Archive for Weak<T>

§

type Archived = ArchivedRcWeak<<T as ArchiveUnsized>::Archived, RcFlavor>

§

type Resolver = RcWeakResolver<<T as ArchiveUnsized>::MetadataResolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for u8

§

type Archived = u8

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T: Archive> Archive for Vec<T>

§

type Archived = ArchivedVec<<T as Archive>::Archived>

§

type Resolver = VecResolver

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for u128

§

type Archived = u128

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T: Archive, const N: usize> Archive for [T; N]

§

type Archived = [<T as Archive>::Archived; N]

§

type Resolver = [<T as Archive>::Resolver; N]

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for char

§

type Archived = char

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T: ArchiveUnsized + ?Sized> Archive for Arc<T>

§

type Archived = ArchivedRc<<T as ArchiveUnsized>::Archived, ArcFlavor>

§

type Resolver = RcResolver<<T as ArchiveUnsized>::MetadataResolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T: Archive> Archive for RangeFrom<T>

§

type Archived = ArchivedRangeFrom<<T as Archive>::Archived>

§

type Resolver = RangeFrom<<T as Archive>::Resolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for CString

§

type Archived = ArchivedCString

§

type Resolver = CStringResolver

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for f32_be

§

type Archived = BigEndian<f32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T9: Archive, T8: Archive, T7: Archive, T6: Archive, T5: Archive, T4: Archive, T3: Archive, T2: Archive, T1: Archive, T0: Archive> Archive for (T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)

§

type Archived = (<T9 as Archive>::Archived, <T8 as Archive>::Archived, <T7 as Archive>::Archived, <T6 as Archive>::Archived, <T5 as Archive>::Archived, <T4 as Archive>::Archived, <T3 as Archive>::Archived, <T2 as Archive>::Archived, <T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T9 as Archive>::Resolver, <T8 as Archive>::Resolver, <T7 as Archive>::Resolver, <T6 as Archive>::Resolver, <T5 as Archive>::Resolver, <T4 as Archive>::Resolver, <T3 as Archive>::Resolver, <T2 as Archive>::Resolver, <T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for NonZeroU32_le

§

type Archived = LittleEndian<NonZeroU32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T4: Archive, T3: Archive, T2: Archive, T1: Archive, T0: Archive> Archive for (T4, T3, T2, T1, T0)

§

type Archived = (<T4 as Archive>::Archived, <T3 as Archive>::Archived, <T2 as Archive>::Archived, <T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T4 as Archive>::Resolver, <T3 as Archive>::Resolver, <T2 as Archive>::Resolver, <T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T: Archive> Archive for RangeTo<T>

§

type Archived = ArchivedRangeTo<<T as Archive>::Archived>

§

type Resolver = RangeTo<<T as Archive>::Resolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for NonZeroI64

§

type Archived = NonZeroI64

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU128_le

§

type Archived = LittleEndian<NonZeroU128>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for Ipv4Addr

§

type Archived = ArchivedIpv4Addr

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i64_be

§

type Archived = BigEndian<i64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroI64_le

§

type Archived = LittleEndian<NonZeroI64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroI16_le

§

type Archived = LittleEndian<NonZeroI16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroIsize

§

type Archived = <NonZeroI32 as Archive>::Archived

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i128_le

§

type Archived = LittleEndian<i128>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicI16_le

§

type Archived = LittleEndian<i16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<K: Archive + Ord, V: Archive> Archive for BTreeMap<K, V>where K::Archived: Ord,

§

type Archived = ArchivedBTreeMap<<K as Archive>::Archived, <V as Archive>::Archived>

§

type Resolver = BTreeMapResolver

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T: Archive, E: Archive> Archive for Result<T, E>

§

type Archived = ArchivedResult<<T as Archive>::Archived, <E as Archive>::Archived>

§

type Resolver = Result<<T as Archive>::Resolver, <E as Archive>::Resolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for usize

§

type Archived = <u32 as Archive>::Archived

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroI128_le

§

type Archived = LittleEndian<NonZeroI128>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroUsize

§

type Archived = <NonZeroU32 as Archive>::Archived

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicU32

§

type Archived = u32

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T: Archive> Archive for Range<T>

§

type Archived = ArchivedRange<<T as Archive>::Archived>

§

type Resolver = Range<<T as Archive>::Resolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for AtomicI64

§

type Archived = i64

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T7: Archive, T6: Archive, T5: Archive, T4: Archive, T3: Archive, T2: Archive, T1: Archive, T0: Archive> Archive for (T7, T6, T5, T4, T3, T2, T1, T0)

§

type Archived = (<T7 as Archive>::Archived, <T6 as Archive>::Archived, <T5 as Archive>::Archived, <T4 as Archive>::Archived, <T3 as Archive>::Archived, <T2 as Archive>::Archived, <T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T7 as Archive>::Resolver, <T6 as Archive>::Resolver, <T5 as Archive>::Resolver, <T4 as Archive>::Resolver, <T3 as Archive>::Resolver, <T2 as Archive>::Resolver, <T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for AtomicU32_le

§

type Archived = LittleEndian<u32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for u128_le

§

type Archived = LittleEndian<u128>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for u128_be

§

type Archived = BigEndian<u128>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T1: Archive, T0: Archive> Archive for (T1, T0)

§

type Archived = (<T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for AtomicI16

§

type Archived = i16

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroI32

§

type Archived = NonZeroI32

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T: ArchiveUnsized + ?Sized> Archive for Weak<T>

§

type Archived = ArchivedRcWeak<<T as ArchiveUnsized>::Archived, ArcFlavor>

§

type Resolver = RcWeakResolver<<T as ArchiveUnsized>::MetadataResolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for SocketAddrV4

§

type Archived = ArchivedSocketAddrV4

§

type Resolver = ()

source§

unsafe fn resolve( &self, pos: usize, _: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for AtomicI8

§

type Archived = i8

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i128_be

§

type Archived = BigEndian<i128>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<K: Archive + Hash + Eq, V: Archive, S> Archive for HashMap<K, V, S>where K::Archived: Hash + Eq,

§

type Archived = ArchivedHashMap<<K as Archive>::Archived, <V as Archive>::Archived>

§

type Resolver = HashMapResolver

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T2: Archive, T1: Archive, T0: Archive> Archive for (T2, T1, T0)

§

type Archived = (<T2 as Archive>::Archived, <T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T2 as Archive>::Resolver, <T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for f32_le

§

type Archived = LittleEndian<f32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for f64

§

type Archived = f64

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU64

§

type Archived = NonZeroU64

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicU64

§

type Archived = u64

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i64

§

type Archived = i64

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU128

§

type Archived = NonZeroU128

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroI128_be

§

type Archived = BigEndian<NonZeroI128>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU16_be

§

type Archived = BigEndian<NonZeroU16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU64_be

§

type Archived = BigEndian<NonZeroU64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i16

§

type Archived = i16

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for u64_be

§

type Archived = BigEndian<u64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i16_be

§

type Archived = BigEndian<i16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for u32_le

§

type Archived = LittleEndian<u32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i32_be

§

type Archived = BigEndian<i32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T0: Archive> Archive for (T0,)

§

type Archived = (<T0 as Archive>::Archived,)

§

type Resolver = (<T0 as Archive>::Resolver,)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for AtomicU64_le

§

type Archived = LittleEndian<u64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i8

§

type Archived = i8

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicU16

§

type Archived = u16

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for Duration

§

type Archived = ArchivedDuration

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T: Archive> Archive for RangeInclusive<T>

§

type Archived = ArchivedRangeInclusive<<T as Archive>::Archived>

§

type Resolver = Range<<T as Archive>::Resolver>

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for NonZeroI8

§

type Archived = NonZeroI8

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicUsize

§

type Archived = <u32 as Archive>::Archived

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for f32

§

type Archived = f32

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicI32

§

type Archived = i32

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for u16_be

§

type Archived = BigEndian<u16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU128_be

§

type Archived = BigEndian<NonZeroU128>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for IpAddr

§

type Archived = ArchivedIpAddr

§

type Resolver = ()

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for AtomicU8

§

type Archived = u8

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicI32_le

§

type Archived = LittleEndian<i32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<K: Archive + Hash + Eq, V: Archive, S> Archive for HashMap<K, V, S>where K::Archived: Hash + Eq,

§

type Archived = ArchivedHashMap<<K as Archive>::Archived, <V as Archive>::Archived>

§

type Resolver = HashMapResolver

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for NonZeroU64_le

§

type Archived = LittleEndian<NonZeroU64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicIsize

§

type Archived = <i32 as Archive>::Archived

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicI16_be

§

type Archived = BigEndian<i16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for ()

§

type Archived = ()

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU32

§

type Archived = NonZeroU32

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for char_be

§

type Archived = BigEndian<char>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicU16_be

§

type Archived = BigEndian<u16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i16_le

§

type Archived = LittleEndian<i16>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for u64_le

§

type Archived = LittleEndian<u64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for String

§

type Archived = ArchivedString

§

type Resolver = StringResolver

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for AtomicI64_le

§

type Archived = LittleEndian<i64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroI128

§

type Archived = NonZeroI128

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for i64_le

§

type Archived = LittleEndian<i64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for Ipv6Addr

§

type Archived = ArchivedIpv6Addr

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicBool

§

type Archived = bool

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T6: Archive, T5: Archive, T4: Archive, T3: Archive, T2: Archive, T1: Archive, T0: Archive> Archive for (T6, T5, T4, T3, T2, T1, T0)

§

type Archived = (<T6 as Archive>::Archived, <T5 as Archive>::Archived, <T4 as Archive>::Archived, <T3 as Archive>::Archived, <T2 as Archive>::Archived, <T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T6 as Archive>::Resolver, <T5 as Archive>::Resolver, <T4 as Archive>::Resolver, <T3 as Archive>::Resolver, <T2 as Archive>::Resolver, <T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for AtomicU32_be

§

type Archived = BigEndian<u32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicI64_be

§

type Archived = BigEndian<i64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroI16

§

type Archived = NonZeroI16

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for PhantomPinned

§

type Archived = PhantomPinned

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, _: *mut Self::Archived)

source§

impl Archive for i32_le

§

type Archived = LittleEndian<i32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for char_le

§

type Archived = LittleEndian<char>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU8

§

type Archived = NonZeroU8

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for RangeFull

§

type Archived = RangeFull

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, _: *mut Self::Archived)

source§

impl<K: Archive + Hash + Eq, S> Archive for HashSet<K, S>where K::Archived: Hash + Eq,

§

type Archived = ArchivedHashSet<<K as Archive>::Archived>

§

type Resolver = HashSetResolver

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for f64_be

§

type Archived = BigEndian<f64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<K: Archive + Ord> Archive for BTreeSet<K>where K::Archived: Ord,

§

type Archived = ArchivedBTreeSet<<K as Archive>::Archived>

§

type Resolver = BTreeSetResolver

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl Archive for isize

§

type Archived = <i32 as Archive>::Archived

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for u32_be

§

type Archived = BigEndian<u32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for AtomicU64_be

§

type Archived = BigEndian<u64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for u16

§

type Archived = u16

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl<T11: Archive, T10: Archive, T9: Archive, T8: Archive, T7: Archive, T6: Archive, T5: Archive, T4: Archive, T3: Archive, T2: Archive, T1: Archive, T0: Archive> Archive for (T11, T10, T9, T8, T7, T6, T5, T4, T3, T2, T1, T0)

§

type Archived = (<T11 as Archive>::Archived, <T10 as Archive>::Archived, <T9 as Archive>::Archived, <T8 as Archive>::Archived, <T7 as Archive>::Archived, <T6 as Archive>::Archived, <T5 as Archive>::Archived, <T4 as Archive>::Archived, <T3 as Archive>::Archived, <T2 as Archive>::Archived, <T1 as Archive>::Archived, <T0 as Archive>::Archived)

§

type Resolver = (<T11 as Archive>::Resolver, <T10 as Archive>::Resolver, <T9 as Archive>::Resolver, <T8 as Archive>::Resolver, <T7 as Archive>::Resolver, <T6 as Archive>::Resolver, <T5 as Archive>::Resolver, <T4 as Archive>::Resolver, <T3 as Archive>::Resolver, <T2 as Archive>::Resolver, <T1 as Archive>::Resolver, <T0 as Archive>::Resolver)

source§

unsafe fn resolve( &self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived )

source§

impl<T: ?Sized> Archive for PhantomData<T>

§

type Archived = PhantomData<T>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, _: *mut Self::Archived)

source§

impl Archive for bool

§

type Archived = bool

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroI32_le

§

type Archived = LittleEndian<NonZeroI32>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for NonZeroU16

§

type Archived = NonZeroU16

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

source§

impl Archive for f64_le

§

type Archived = LittleEndian<f64>

§

type Resolver = ()

source§

unsafe fn resolve(&self, _: usize, _: Self::Resolver, out: *mut Self::Archived)

Implementors§