Trait base64::engine::DecodeEstimate
source · pub trait DecodeEstimate {
// Required method
fn decoded_len_estimate(&self) -> usize;
}
Expand description
The decode estimate used by an engine implementation. Users do not need to interact with this; it is only for engine implementors.
Implementors may store relevant data here when constructing this to avoid having to calculate them again during actual decoding.
Required Methods§
sourcefn decoded_len_estimate(&self) -> usize
fn decoded_len_estimate(&self) -> usize
Returns a conservative (err on the side of too big) estimate of the decoded length to use for pre-allocating buffers, etc.
The estimate must be no larger than the next largest complete triple of decoded bytes. That is, the final quad of tokens to decode may be assumed to be complete with no padding.
Panics
Panics if decoded length estimation overflows.
This would happen for sizes within a few bytes of the maximum value of usize
.