Trait rkyv::ser::ScratchSpace
source · pub trait ScratchSpace: Fallible {
// Required methods
unsafe fn push_scratch(
&mut self,
layout: Layout,
) -> Result<NonNull<[u8]>, Self::Error>;
unsafe fn pop_scratch(
&mut self,
ptr: NonNull<u8>,
layout: Layout,
) -> Result<(), Self::Error>;
}
Expand description
A serializer that can allocate scratch space.
Required Methods§
sourceunsafe fn pop_scratch(
&mut self,
ptr: NonNull<u8>,
layout: Layout,
) -> Result<(), Self::Error>
unsafe fn pop_scratch( &mut self, ptr: NonNull<u8>, layout: Layout, ) -> Result<(), Self::Error>
Deallocates previously allocated scratch space.
§Safety
ptr
must be the scratch memory last allocated withpush_scratch
.layout
must be the same layout that was used to allocate that block of memory.