Merge pull request #493 from stjepang/cleanup-future

Cleanup future module
pull/501/head
Yoshua Wuyts 5 years ago committed by GitHub
commit 925b42bc89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
use std::future::Future;
use std::pin::Pin;
use std::time::Duration;
use std::future::Future;
use futures_timer::Delay;
use pin_project_lite::pin_project;
@ -9,7 +9,7 @@ use crate::task::{Context, Poll};
pin_project! {
#[doc(hidden)]
#[derive(Debug)]
#[allow(missing_debug_implementations)]
pub struct DelayFuture<F> {
#[pin]
future: F,

@ -1,10 +1,11 @@
use std::pin::Pin;
use std::future::Future;
use std::pin::Pin;
use crate::future::{IntoFuture};
use crate::future::IntoFuture;
use crate::task::{ready, Context, Poll};
#[derive(Debug)]
#[doc(hidden)]
#[allow(missing_debug_implementations)]
pub struct FlattenFuture<Fut1, Fut2> {
state: State<Fut1, Fut2>,
}

@ -152,7 +152,7 @@ extension_trait! {
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
fn delay(self, dur: Duration) -> impl Future<Output = Self::Output> [DelayFuture<Self>]
where
Self: Future + Sized
Self: Sized,
{
DelayFuture::new(self, dur)
}
@ -173,10 +173,13 @@ extension_trait! {
/// ```
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
fn flatten(self) -> impl Future<Output = <<Self as Future>::Output as IntoFuture>::Output> [FlattenFuture<Self, <<Self as Future>::Output as IntoFuture>::Future>]
fn flatten(
self,
) -> impl Future<Output = <Self::Output as IntoFuture>::Output>
[FlattenFuture<Self, <Self::Output as IntoFuture>::Future>]
where
Self: Future + Sized,
<Self as Future>::Output: IntoFuture
Self: Sized,
<Self as Future>::Output: IntoFuture,
{
FlattenFuture::new(self)
}
@ -214,7 +217,7 @@ extension_trait! {
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
fn race<F>(
self,
other: F
other: F,
) -> impl Future<Output = <Self as std::future::Future>::Output> [Race<Self, F>]
where
Self: std::future::Future + Sized,
@ -258,7 +261,7 @@ extension_trait! {
"#]
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
fn try_race<F: std::future::Future, T, E>(
fn try_race<F, T, E>(
self,
other: F
) -> impl Future<Output = <Self as std::future::Future>::Output> [TryRace<Self, F>]

@ -1,10 +1,10 @@
use std::future::Future;
use std::pin::Pin;
use async_macros::MaybeDone;
use pin_project_lite::pin_project;
use crate::task::{Context, Poll};
use std::future::Future;
pin_project! {
#[allow(missing_docs)]

@ -45,7 +45,6 @@ pub trait IntoFuture {
impl<T: Future> IntoFuture for T {
type Output = T::Output;
type Future = T;
fn into_future(self) -> Self::Future {

@ -1,6 +1,6 @@
use std::future::Future;
use std::marker::PhantomData;
use std::pin::Pin;
use std::future::Future;
use crate::task::{Context, Poll};

Loading…
Cancel
Save