unsafe fn resolve_aligned<T: Archive + ?Sized>(
        &mut self,
        value: &T,
        resolver: T::Resolver,
    ) -> Result<usize, Self::Error> {
        let pos = self.pos();
        debug_assert!(pos & (mem::align_of::<T::Archived>() - 1) == 0);

        let mut resolved = mem::MaybeUninit::<T::Archived>::uninit();
        resolved.as_mut_ptr().write_bytes(0, 1);
        value.resolve(pos, resolver, &mut resolved);

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