prs_compress_unsafe_with_allocator

Function prs_compress_unsafe_with_allocator 

Source
pub unsafe fn prs_compress_unsafe_with_allocator<T: MutablePointerSrc, L: Allocator + Copy, S: Allocator + Copy>(
    src: *const u8,
    src_len: usize,
    dest: T,
    long_lived_allocator: L,
    short_lived_allocator: S,
) -> usize
Expand description

Compresses the given data in source, placing it in destimation. Uses a custom allocator for short and long lived memory.

Parameters

  • src: A pointer to the decompressed data.
  • src_len: Length of the decompressed data.
  • destination: A pointer to the compressed data to be written.
  • long_lived_allocator: The allocator to use for long-lived memory allocation.
  • short_lived_allocator: The allocator to use for short-lived memory allocation.

§Returns

Number of bytes written to destination.

§Safety

It’s safe as long as dest has sufficient length (max length: crate::util::prs_calculate_max_compressed_size) and the remaining parameters are valid.