Skip to content

Commit

Permalink
Merge pull request #217 from patrickariel/std-time
Browse files Browse the repository at this point in the history
feat: implement Dummy for `std::time::Duration`
  • Loading branch information
cksac authored Jan 18, 2025
2 parents c34e4d8 + 04722bd commit e49b3a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions fake/src/impls/std/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ pub mod path;
pub mod primitives;
pub mod result;
pub mod string;
pub mod time;
pub mod tuple;
11 changes: 11 additions & 0 deletions fake/src/impls/std/time.rs
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))
}
}

0 comments on commit e49b3a8

Please sign in to comment.