pub trait DistString {
// Required method
fn append_string<R: Rng + ?Sized>(
&self,
rng: &mut R,
string: &mut String,
len: usize,
);
// Provided method
fn sample_string<R: Rng + ?Sized>(&self, rng: &mut R, len: usize) -> String { ... }
}Expand description
String sampler
Sampling a String of random characters is not quite the same as collecting
a sequence of chars. This trait contains some helpers.
Required Methods§
Provided Methods§
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.
Implementors§
impl DistString for Alphanumeric
Available on crate feature
alloc only.impl DistString for Standard
Available on crate feature
alloc only.Note: the String is potentially left with excess capacity; optionally the
user may call string.shrink_to_fit() afterwards.