ZL_CompressorSerializer_serialize

Function ZL_CompressorSerializer_serialize 

Source
pub unsafe extern "C" fn ZL_CompressorSerializer_serialize(
    serializer: *mut ZL_CompressorSerializer,
    compressor: *const ZL_Compressor,
    dst: *mut *mut c_void,
    dstSize: *mut usize,
) -> ZL_Report
Expand description

Returns a serialized representation of the given @p compressor.

See the documentation above for a description of how compressors must be structured to be compressible.

This function uses @p dst and @dstSize both as (1) input arguments that optionally indicate an existing buffer into which the output of the serialization process can be placed as well as (2) output arguments indicating where the output actually was placed.

When @p dst points to a void* variable with a non-NULL initial value, and @p dstSize points to a size_t variable with a non-zero initial value, this function will attempt to write the serialized output into the buffer pointed to by *dst with capacity *dstSize. If the output fits in that provided buffer, then *dst will be left unchanged, and *dstSize will be updated to reflect the written size of the output.

Otherwise, either because the output doesn’t fit in the provided buffer or because no buffer was provided (*dst is NULL or *dstSize == 0), an output buffer of sufficient size to hold the output is allocated. *dst is set to point to the start of that buffer and *dstSize is set to the size of the output. That buffer is owned by @p serializer and will be freed when the @p serializer is destroyed.

@param[in out] dst Pointer to a variable pointing to the output buffer, which can start out either pointing to an existing output buffer or NULL. That variable will be set to point to the output buffer actually used. @param[in out] dstSize Pointer to a variable that should be initialized to the capacity of the output buffer, if one is being provided, or 0 otherwise. That variable will be set to contain the written size of the output.

@returns success or an error.