/// Resolves the given reference with its resolver and writes the archived reference.
///
/// Returns the position of the written archived reference.
///
/// # Safety
///
/// The caller must guarantee that the serializer is aligned for the archived reference of the
/// given type.
Resolves the given reference with its resolver and writes the archived reference.
Returns the position of the written archived reference.
Resolves the given reference with its resolver and writes the archived reference . Returns the position of the written archived reference .
unsafe fn resolve_unsized_aligned<T: ArchiveUnsized + ?Sized>(
        &mut self,
        value: &T,
        to: usize,
        metadata_resolver: T::MetadataResolver,
    ) -> Result<usize, Self::Error> {
        let from = self.pos();
        debug_assert!(from & (mem::align_of::<RelPtr<T::Archived>>() - 1) == 0);
        let mut resolved = mem::MaybeUninit::<RelPtr<T::Archived>>::uninit();
        resolved.as_mut_ptr().write_bytes(0, 1);
        value.resolve_unsized(from, to, metadata_resolver, &mut resolved);
        let data = resolved.as_ptr().cast::<u8>();
        let len = mem::size_of::<RelPtr<T::Archived>>();
        self.write(slice::from_raw_parts(data, len))?;
        Ok(from)
    }
unsafe fn resolve_unsized_aligned < T : ArchiveUnsized + ? Sized > ( & mut self , value : & T , to : usize , metadata_resolver : T :: MetadataResolver , ) -> Result < usize , Self :: Error > { let from = self . pos ( ) ; debug_assert ! ( from ( mem align_of RelPtr T Archived ( ) 1 ) 0 ) ; let mut resolved = mem :: MaybeUninit :: < RelPtr < T :: Archived > > :: uninit ( ) ; resolved . as_mut_ptr ( ) . write_bytes ( 0 , 1 ) ; value . resolve_unsized ( from , to , metadata_resolver , & mut resolved ) ; let data = resolved . as_ptr ( ) . cast :: < u8 > ( ) ; let len = mem :: size_of :: < RelPtr < T :: Archived > > ( ) ; self . write ( slice :: from_raw_parts ( data , len ) ) ? ; Ok ( from ) }
Resolves the given reference with its resolver and writes the archived reference.
Resolves the given reference with its resolver and writes the archived reference .
&mut self
value
&T
to
usize
metadata_resolver
T::MetadataResolver
safety
The caller must guarantee that the serializer is aligned for the archived reference of the
given type.
The caller must guarantee that the serializer is aligned for the archived reference of the given type .