mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-31 12:18:31 +00:00
21 lines
361 B
Rust
21 lines
361 B
Rust
|
use std::clone::Clone;
|
||
|
|
||
|
use futures::{stream::Map, Stream, StreamExt};
|
||
|
|
||
|
pub trait Cloned<'a, T, S>
|
||
|
where
|
||
|
S: Stream<Item = &'a T>,
|
||
|
T: Clone + 'a,
|
||
|
{
|
||
|
fn cloned(self) -> Map<S, fn(&T) -> T>;
|
||
|
}
|
||
|
|
||
|
impl<'a, T, S> Cloned<'a, T, S> for S
|
||
|
where
|
||
|
S: Stream<Item = &'a T>,
|
||
|
T: Clone + 'a,
|
||
|
{
|
||
|
#[inline]
|
||
|
fn cloned(self) -> Map<S, fn(&T) -> T> { self.map(Clone::clone) }
|
||
|
}
|