-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert basic futures combinators to futures-core 0.3
This commit includes the introduction of a `FutureResult` trait along the lines of the RFC (with some slight revisions). It tackles all the "basic" combinators, but leaves off `shared`, `select`, and `join` for the moment.
- Loading branch information
Showing
32 changed files
with
1,081 additions
and
1,051 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,5 @@ members = [ | |
# "futures-macro-await", | ||
# "futures-sink", | ||
# "futures-stable", | ||
# "futures-util", | ||
"futures-util", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
//! Definition of the Empty combinator, a future that's never ready. | ||
use core::mem::Pin; | ||
use core::marker; | ||
|
||
use futures_core::{Future, Poll, Async}; | ||
use futures_core::{Future, Poll}; | ||
use futures_core::task; | ||
|
||
/// A future which is never resolved. | ||
/// | ||
/// This future can be created with the `empty` function. | ||
#[derive(Debug)] | ||
#[must_use = "futures do nothing unless polled"] | ||
pub struct Empty<T, E> { | ||
_data: marker::PhantomData<(T, E)>, | ||
pub struct Empty<T> { | ||
_data: marker::PhantomData<T>, | ||
} | ||
|
||
/// Creates a future which never resolves, representing a computation that never | ||
/// finishes. | ||
/// | ||
/// The returned future will forever return `Async::Pending`. | ||
pub fn empty<T, E>() -> Empty<T, E> { | ||
pub fn empty<T>() -> Empty<T> { | ||
Empty { _data: marker::PhantomData } | ||
} | ||
|
||
impl<T, E> Future for Empty<T, E> { | ||
type Item = T; | ||
type Error = E; | ||
impl<T> Future for Empty<T> { | ||
type Output = T; | ||
|
||
fn poll(&mut self, _: &mut task::Context) -> Poll<T, E> { | ||
Ok(Async::Pending) | ||
fn poll(self: Pin<Self>, _: &mut task::Context) -> Poll<T> { | ||
Poll::Pending | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.