pub trait SampleString {
// 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
Required Methods§
Sourcefn append_string<R: Rng + ?Sized>(
&self,
rng: &mut R,
string: &mut String,
len: usize,
)
fn append_string<R: Rng + ?Sized>( &self, rng: &mut R, string: &mut String, len: usize, )
Append len
random chars to string
Note: implementations may leave string
with excess capacity. If this
is undesirable, consider calling String::shrink_to_fit
after this
method.
Provided Methods§
Sourcefn sample_string<R: Rng + ?Sized>(&self, rng: &mut R, len: usize) -> String
fn sample_string<R: Rng + ?Sized>(&self, rng: &mut R, len: usize) -> String
Generate a String
of len
random chars
Note: implementations may leave the string with excess capacity. If this
is undesirable, consider calling String::shrink_to_fit
after this
method.
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.