Skip to content

Commit

Permalink
add cow
Browse files Browse the repository at this point in the history
  • Loading branch information
cksac committed Feb 9, 2024
1 parent a85bf51 commit b2cb752
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fake/src/impls/std/container.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::Dummy;
use rand::Rng;
use std::borrow::Cow;
use std::cell::{Cell, RefCell};
use std::ops::Deref;
use std::pin::Pin;
Expand Down Expand Up @@ -36,3 +37,12 @@ where
Pin::new(T::dummy_with_rng(config, rng))
}
}

impl<'a, T, U> Dummy<U> for Cow<'a, T>
where
T: Dummy<U> + Clone,
{
fn dummy_with_rng<R: Rng + ?Sized>(config: &U, rng: &mut R) -> Self {
Cow::Owned(T::dummy_with_rng(config, rng))
}
}

0 comments on commit b2cb752

Please sign in to comment.