sanitise_file_name

Function max_alloc_size

Source
pub const fn max_alloc_size<R: Replace>(options: &Options<R>) -> usize
Expand description

Calculate the maximum allocation size required for a given set of options, to correctly handle any input.

This is intended for the scratch buffer approach, where you keep one string around and keep on sanitising a whole bunch of inputs into it in turn, or for array-allocated strings like with tinyvec_string.

This is a const fn because this crate was compiled with the const-fn-trait-bound feature enabled (which requires nightly rustc at the time of writing).

See also max_alloc_size_const for an example of using this with tinyvec_string.