xz2 decoders are by default configured with a memory limit value of u64::max. This is problematic on targets where there is limited memory available for decoding. e.g. one could run out of memory. By exposing an additional function call XzDecoder::with_memlimit(..) and LzmaDecoder::with_memlimit(..) users can initialize a decoder with a given memory limit.
Consequently specifying a too low value means the decoder will fail to decompress. On this occasion the decoder will return an io::Error::Custom value with the message "MemLimit" to signal it needs to be configured with more memory.
This error is propagated by the chosen interface, AsyncBufRead or AsyncWrite, therefore no additional error handling has to be implemented to handle this "side effect"
xz2 decoders are by default configured with a memory limit value of u64::max. This is problematic on targets where there is limited memory available for decoding. e.g. one could run out of memory. By exposing an additional function call
XzDecoder::with_memlimit(..)
andLzmaDecoder::with_memlimit(..)
users can initialize a decoder with a given memory limit.Consequently specifying a too low value means the decoder will fail to decompress. On this occasion the decoder will return an
io::Error::Custom
value with the message "MemLimit" to signal it needs to be configured with more memory.This error is propagated by the chosen interface,
AsyncBufRead
orAsyncWrite
, therefore no additional error handling has to be implemented to handle this "side effect"