Skip to content

Commit 980984c

Browse files
committed
refactor: remove lifetime bound from YieldFut
1 parent c00f142 commit 980984c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/lib.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use alloc::sync::{Arc, Weak};
88
use core::{
99
cell::Cell,
1010
future::Future,
11-
marker::PhantomData,
1211
pin::Pin,
1312
sync::atomic::{AtomicBool, Ordering},
1413
task::{Context, Poll}
@@ -47,7 +46,7 @@ pub struct Yielder<T> {
4746
}
4847

4948
impl<T> Yielder<T> {
50-
pub fn r#yield(&self, value: T) -> YieldFut<'_, T> {
49+
pub fn r#yield(&self, value: T) -> YieldFut<T> {
5150
#[cold]
5251
fn invalid_usage() -> ! {
5352
panic!("attempted to use async_stream_lite yielder outside of stream context or across threads")
@@ -62,22 +61,21 @@ impl<T> Yielder<T> {
6261

6362
store.cell.replace(Some(value));
6463

65-
YieldFut { store, _p: PhantomData }
64+
YieldFut { store }
6665
}
6766
}
6867

6968
/// Future returned by an [`AsyncStream`]'s yield function.
7069
///
7170
/// This future must be `.await`ed inside the generator in order for the item to be yielded by the stream.
7271
#[must_use = "stream will not yield this item unless the future returned by yield is awaited"]
73-
pub struct YieldFut<'y, T> {
72+
pub struct YieldFut<T> {
7473
store: Arc<SharedStore<T>>,
75-
_p: PhantomData<&'y ()>
7674
}
7775

78-
impl<T> Unpin for YieldFut<'_, T> {}
76+
impl<T> Unpin for YieldFut<T> {}
7977

80-
impl<T> Future for YieldFut<'_, T> {
78+
impl<T> Future for YieldFut<T> {
8179
type Output = ();
8280

8381
fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {

0 commit comments

Comments
 (0)