-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement Dummy for std::time::Duration
- Loading branch information
1 parent
4cfcb90
commit 04722bd
Showing
2 changed files
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ pub mod path; | |
pub mod primitives; | ||
pub mod result; | ||
pub mod string; | ||
pub mod time; | ||
pub mod tuple; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use std::time::Duration; | ||
|
||
use crate::{Dummy, Fake, Faker}; | ||
use rand::Rng; | ||
|
||
impl Dummy<Faker> for Duration { | ||
#[inline] | ||
fn dummy_with_rng<R: Rng + ?Sized>(_: &Faker, rng: &mut R) -> Self { | ||
Duration::from_nanos(Faker.fake_with_rng(rng)) | ||
} | ||
} |