pub struct RandomStringBuilder { /* private fields */ }Expand description
A random String builder, providig fined-grained control over what a random String should contain.
If no charsets are supplied, the build() step will
produce a None value.
§Examples
Random phone number
use random_str::random::{RandomStringBuilder, CharBuilder};
let digits: Option<String> = RandomStringBuilder::new()
.with_length(10)
.with_numbers()
.build();
let random_phone_number = format!("+52 {}", digits.unwrap());
println!("Random phone number: {}", random_phone_number);Random password
use random_str::random::{RandomStringBuilder, CharBuilder};
let random_password: Option<String> = RandomStringBuilder::new()
.with_length(32) // Optional, 16 as default
.with_lowercase()
.with_uppercase()
.with_numbers()
.with_symbols()
.build();
println!("Random password: {}", random_password.unwrap());Implementations§
Trait Implementations§
Source§impl CharBuilder for RandomStringBuilder
impl CharBuilder for RandomStringBuilder
Auto Trait Implementations§
impl Freeze for RandomStringBuilder
impl RefUnwindSafe for RandomStringBuilder
impl Send for RandomStringBuilder
impl Sync for RandomStringBuilder
impl Unpin for RandomStringBuilder
impl UnsafeUnpin for RandomStringBuilder
impl UnwindSafe for RandomStringBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more