pub unsafe trait Encoder {
const CHARSET: &[u8];
const MIN_LEN: usize;
}Expand description
Specifies parameters for encoding random data into a valid utf-8 String.
All provided implementations list their minimum secure length in the documentation of their unit struct, and it is highly recommended that custom implementations do the same.
§Safety
The CHARSET field must only contain valid ascii characters.
Meaning that all u8 values must be in the interval [0, 128).
Failure to uphold this condition will result in text methods
returning invalid Strings’s.
The MIN_LEN field must be at least ceil(logbase(2128)),
where base is the length of the CHARSET field. Failure to uphold
this condition will result in poor security of generated String’s.
Required Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.