Skip to content

Commit 9711e27

Browse files
committed
Add forwarding Future implementation for Id
1 parent 61f0b73 commit 9711e27

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

objc2/src/rc/id_forwarding_impls.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ use alloc::string::String;
1111
use alloc::vec::Vec;
1212
use core::cmp::Ordering;
1313
use core::fmt;
14+
use core::future::Future;
1415
use core::hash;
1516
use core::iter::FusedIterator;
17+
use core::pin::Pin;
18+
use core::task::{Context, Poll};
1619
use std::error::Error;
1720
use std::io;
1821

@@ -273,12 +276,12 @@ impl<T: io::BufRead> io::BufRead for Id<T, Owned> {
273276
}
274277
}
275278

276-
// TODO:
277-
// impl<F: Future + Unpin> Future for Id<F, Owned> {
278-
// type Output = F::Output;
279-
// fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
280-
// F::poll(Pin::new(&mut *self), cx)
281-
// }
282-
// }
279+
impl<T: Future + Unpin> Future for Id<T, Owned> {
280+
type Output = T::Output;
281+
282+
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
283+
T::poll(Pin::new(&mut *self), cx)
284+
}
285+
}
283286

284287
// TODO: impl Fn traits, CoerceUnsized, Stream and so on when stabilized

0 commit comments

Comments
 (0)