Struct random_user::UserGenerator
source · pub struct UserGenerator { /* private fields */ }Expand description
Random user generator
Example:
let generator = UserGenerator::new();
let user = generator.fetch_one().await?
println!("{:#?}", user);Implementations§
source§impl UserGenerator
impl UserGenerator
pub fn new() -> UserGenerator
sourcepub async fn fetch_with_info(
&self,
count: usize
) -> Result<RandomUserResult, RandomUserError>
pub async fn fetch_with_info( &self, count: usize ) -> Result<RandomUserResult, RandomUserError>
Generate users with the api informations
Example:
// Fetch 5 random users with api info
let users = generator.fetch_with_info(5).await?
println!("{:?}", users.info);
for user in users.results {
prinln!("{user:?}");
}
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for UserGenerator
impl Send for UserGenerator
impl Sync for UserGenerator
impl Unpin for UserGenerator
impl !UnwindSafe for UserGenerator
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