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 all 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 generation of
invalid String values.
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 values.
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.