sanitise_file_name

Function max_alloc_size_const

Source
pub const fn max_alloc_size_const(options: &Options<Option<char>>) -> usize
Expand description

A const variant of max_alloc_size.

Sample usage, combined with tinyvec_string (with its rustc_1_55 feature enabled):

use tinyvec_string::ArrayString;
let mut string =
    ArrayString::<[u8; max_alloc_size_const(&Options::DEFAULT)]>::new();
sanitise_to("input name", &Options::DEFAULT, &mut string);

Once const-fn-trait-bound is stabilised, this method will be deprecated. Since you compiled this crate with the const-fn-trait-bound feature, you don’t need this method. Be cheerful and use max_alloc_size instead!