logo
pub trait ScratchSpace: Fallible {
    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

Allocates scratch space of the requested size.

Safety

layout must have non-zero size.

Deallocates previously allocated scratch space.

Safety
  • ptr must be the scratch memory last allocated with push_scratch.
  • layout must be the same layout that was used to allocate that block of memory.

Implementors