Skip to content

Commit 7669031

Browse files
authored
Do not require Clone for Shared::peek (#2662)
Makes it easier to write some generic code for wrappers of `Shared` future: no need to properly specify all type parameters.
1 parent 260f9e9 commit 7669031

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

futures-util/src/future/future/shared.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ impl<Fut: Future> Shared<Fut> {
103103
impl<Fut> Shared<Fut>
104104
where
105105
Fut: Future,
106-
Fut::Output: Clone,
107106
{
108107
/// Returns [`Some`] containing a reference to this [`Shared`]'s output if
109108
/// it has already been computed by a clone or [`None`] if it hasn't been
@@ -160,7 +159,6 @@ where
160159
impl<Fut> Inner<Fut>
161160
where
162161
Fut: Future,
163-
Fut::Output: Clone,
164162
{
165163
/// Safety: callers must first ensure that `self.inner.state`
166164
/// is `COMPLETE`
@@ -170,6 +168,13 @@ where
170168
FutureOrOutput::Future(_) => unreachable!(),
171169
}
172170
}
171+
}
172+
173+
impl<Fut> Inner<Fut>
174+
where
175+
Fut: Future,
176+
Fut::Output: Clone,
177+
{
173178
/// Registers the current task to receive a wakeup when we are awoken.
174179
fn record_waker(&self, waker_key: &mut usize, cx: &mut Context<'_>) {
175180
let mut wakers_guard = self.notifier.wakers.lock().unwrap();

0 commit comments

Comments
 (0)