pub struct FakerConfig {
pub locale: String,
pub rng: Rc<RefCell<StdRng>>,
}Expand description
Faker configuration
Fields§
§locale: StringCurrent locale (default: “en”)
rng: Rc<RefCell<StdRng>>Random number generator
Implementations§
Source§impl FakerConfig
impl FakerConfig
Sourcepub fn set_locale(locale: &str)
pub fn set_locale(locale: &str)
Set the locale
Sourcepub fn rand_usize(&self, max: usize) -> usize
pub fn rand_usize(&self, max: usize) -> usize
Generate a random usize
Sourcepub fn rand_range(&self, min: u32, max: u32) -> u32
pub fn rand_range(&self, min: u32, max: u32) -> u32
Generate a random number between min and max (inclusive)
Sourcepub fn rand_range_i64(&self, min: i64, max: i64) -> i64
pub fn rand_range_i64(&self, min: i64, max: i64) -> i64
Generate a random i64 between min and max
Trait Implementations§
Source§impl Clone for FakerConfig
impl Clone for FakerConfig
Source§fn clone(&self) -> FakerConfig
fn clone(&self) -> FakerConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FakerConfig
impl Debug for FakerConfig
Auto Trait Implementations§
impl Freeze for FakerConfig
impl !RefUnwindSafe for FakerConfig
impl !Send for FakerConfig
impl !Sync for FakerConfig
impl Unpin for FakerConfig
impl UnsafeUnpin for FakerConfig
impl !UnwindSafe for FakerConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more