Skip to content

Commit

Permalink
Remove deprecated functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
cramertj committed Feb 5, 2018
1 parent a45249c commit 18c4984
Show file tree
Hide file tree
Showing 29 changed files with 56 additions and 2,348 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ script:
- cargo build
- cargo build --no-default-features
- cargo test
- cargo test --no-default-features --features use_std
- cargo test --no-default-features --features std
- cargo test --manifest-path futures-cpupool/Cargo.toml
- cargo test --manifest-path futures-cpupool/Cargo.toml --no-default-features

Expand Down
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ appveyor = { repository = "alexcrichton/futures-rs" }
[dependencies]

[features]
use_std = []
with-deprecated = []
default = ["use_std", "with-deprecated"]
std = []
default = ["std"]

[workspace]
members = ["futures-cpupool"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ For more information about how you can use futures with async I/O you can take a
look at [https://tokio.rs](https://tokio.rs) which is an introduction to both
the Tokio stack and also futures.

### Feature `use_std`
### Feature `std`

`futures-rs` works without the standard library, such as in bare metal environments.
However, it has a significantly reduced API surface. To use `futures-rs` in
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ test_script:
- cargo build
- cargo build --no-default-features
- cargo test
- cargo test --no-default-features --features use_std
- cargo test --no-default-features --features std
- cargo test --manifest-path futures-cpupool/Cargo.toml
6 changes: 1 addition & 5 deletions futures-cpupool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@ num_cpus = "1.0"
path = ".."
version = "0.1"
default-features = false
features = ["use_std"]

[features]
default = ["with-deprecated"]
with-deprecated = ["futures/with-deprecated"]
features = ["std"]
4 changes: 2 additions & 2 deletions src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
//! [online]: https://tokio.rs/docs/going-deeper-futures/tasks/

#[allow(deprecated)]
#[cfg(feature = "use_std")]
pub use task_impl::{Unpark, Executor, Run};
#[cfg(feature = "std")]
pub use task_impl::{Executor, Run};

pub use task_impl::{Spawn, spawn, Notify, with_notify};

Expand Down
81 changes: 6 additions & 75 deletions src/future/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,6 @@ pub use self::poll_fn::{poll_fn, PollFn};
pub use self::result_::{result, ok, err, FutureResult};
pub use self::loop_fn::{loop_fn, Loop, LoopFn};

#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "use `ok` instead")]
#[cfg(feature = "with-deprecated")]
pub use self::{ok as finished, Ok as Finished};
#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "use `err` instead")]
#[cfg(feature = "with-deprecated")]
pub use self::{err as failed, Err as Failed};
#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "use `result` instead")]
#[cfg(feature = "with-deprecated")]
pub use self::{result as done, FutureResult as Done};
#[doc(hidden)]
#[deprecated(since = "0.1.7", note = "use `FutureResult` instead")]
#[cfg(feature = "with-deprecated")]
pub use self::{FutureResult as Ok};
#[doc(hidden)]
#[deprecated(since = "0.1.7", note = "use `FutureResult` instead")]
#[cfg(feature = "with-deprecated")]
pub use self::{FutureResult as Err};

// combinators
mod and_then;
mod flatten;
Expand Down Expand Up @@ -89,22 +68,6 @@ if_std! {
pub use self::select_ok::{SelectOk, select_ok};
pub use self::shared::{Shared, SharedItem, SharedError};

#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "use join_all instead")]
#[cfg(feature = "with-deprecated")]
pub use self::join_all::join_all as collect;
#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "use JoinAll instead")]
#[cfg(feature = "with-deprecated")]
pub use self::join_all::JoinAll as Collect;

/// A type alias for `Box<Future + Send>`
#[doc(hidden)]
#[deprecated(note = "removed without replacement, recommended to use a \
local extension trait or function if needed, more \
details in https://github.com/alexcrichton/futures-rs/issues/228")]
pub type BoxFuture<T, E> = ::std::boxed::Box<Future<Item = T, Error = E> + Send>;

impl<F: ?Sized + Future> Future for ::std::boxed::Box<F> {
type Item = F::Item;
type Error = F::Error;
Expand Down Expand Up @@ -285,52 +248,20 @@ pub trait Future {
/// > blocking work associated with this future will be completed
/// > by another thread.
///
/// This method is only available when the `use_std` feature of this
/// This method is only available when the `std` feature of this
/// library is activated, and it is activated by default.
///
/// # Panics
///
/// This function does not attempt to catch panics. If the `poll` function
/// of this future panics, panics will be propagated to the caller.
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
fn wait(self) -> result::Result<Self::Item, Self::Error>
where Self: Sized
{
::executor::spawn(self).wait_future()
}

/// Convenience function for turning this future into a trait object which
/// is also `Send`.
///
/// This simply avoids the need to write `Box::new` and can often help with
/// type inference as well by always returning a trait object. Note that
/// this method requires the `Send` bound and returns a `BoxFuture`, which
/// also encodes this. If you'd like to create a `Box<Future>` without the
/// `Send` bound, then the `Box::new` function can be used instead.
///
/// This method is only available when the `use_std` feature of this
/// library is activated, and it is activated by default.
///
/// # Examples
///
/// ```
/// use futures::prelude::*;
/// use futures::future::{BoxFuture, result};
///
/// let a: BoxFuture<i32, i32> = result(Ok(1)).boxed();
/// ```
#[cfg(feature = "use_std")]
#[doc(hidden)]
#[deprecated(note = "removed without replacement, recommended to use a \
local extension trait or function if needed, more \
details in https://github.com/alexcrichton/futures-rs/issues/228")]
#[allow(deprecated)]
fn boxed(self) -> BoxFuture<Self::Item, Self::Error>
where Self: Sized + Send + 'static
{
::std::boxed::Box::new(self)
}

/// Map this future's result to a different type, returning a new future of
/// the resulting type.
///
Expand Down Expand Up @@ -939,7 +870,7 @@ pub trait Future {
/// after-the fact. To assist using this method, the `Future` trait is also
/// implemented for `AssertUnwindSafe<F>` where `F` implements `Future`.
///
/// This method is only available when the `use_std` feature of this
/// This method is only available when the `std` feature of this
/// library is activated, and it is activated by default.
///
/// # Examples
Expand All @@ -957,7 +888,7 @@ pub trait Future {
/// });
/// assert!(future.catch_unwind().wait().is_err());
/// ```
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
fn catch_unwind(self) -> CatchUnwind<Self>
where Self: Sized + ::std::panic::UnwindSafe
{
Expand All @@ -976,7 +907,7 @@ pub trait Future {
/// access to the underlying result. Ownership of `Self::Item` and
/// `Self::Error` cannot currently be reclaimed.
///
/// This method is only available when the `use_std` feature of this
/// This method is only available when the `std` feature of this
/// library is activated, and it is activated by default.
///
/// # Examples
Expand Down Expand Up @@ -1006,7 +937,7 @@ pub trait Future {
/// assert_eq!(6, *shared1.wait().unwrap());
/// join_handle.join().unwrap();
/// ```
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
fn shared(self) -> Shared<Self>
where Self: Sized
{
Expand Down
8 changes: 0 additions & 8 deletions src/future/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,6 @@ pub fn new<F: Future>(future: F) -> Shared<F> {
}

impl<F> Shared<F> where F: Future {
// TODO: make this private
#[deprecated(since = "0.1.12", note = "use `Future::shared` instead")]
#[cfg(feature = "with-deprecated")]
#[doc(hidden)]
pub fn new(future: F) -> Self {
new(future)
}

/// If any clone of this `Shared` has completed execution, returns its result immediately
/// without blocking. Otherwise, returns None without triggering the work represented by
/// this `Shared`.
Expand Down
58 changes: 4 additions & 54 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@
#![doc(html_root_url = "https://docs.rs/futures/0.1")]

#[macro_use]
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
extern crate std;

macro_rules! if_std {
($($i:item)*) => ($(
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
$i
)*)
}
Expand All @@ -183,66 +183,16 @@ pub use stream::Stream;
pub mod sink;
pub use sink::Sink;

#[deprecated(since = "0.1.4", note = "import through the future module instead")]
#[cfg(feature = "with-deprecated")]
#[doc(hidden)]
pub use future::{done, empty, failed, finished, lazy};

#[doc(hidden)]
#[cfg(feature = "with-deprecated")]
#[deprecated(since = "0.1.4", note = "import through the future module instead")]
pub use future::{
Done, Empty, Failed, Finished, Lazy, AndThen, Flatten, FlattenStream, Fuse, IntoStream,
Join, Join3, Join4, Join5, Map, MapErr, OrElse, Select,
SelectNext, Then
};

#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
mod lock;
mod task_impl;

mod resultstream;

pub mod task;
pub mod executor;
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
pub mod sync;
#[cfg(feature = "use_std")]
pub mod unsync;


if_std! {
#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "use sync::oneshot::channel instead")]
#[cfg(feature = "with-deprecated")]
pub use sync::oneshot::channel as oneshot;

#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "use sync::oneshot::Receiver instead")]
#[cfg(feature = "with-deprecated")]
pub use sync::oneshot::Receiver as Oneshot;

#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "use sync::oneshot::Sender instead")]
#[cfg(feature = "with-deprecated")]
pub use sync::oneshot::Sender as Complete;

#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "use sync::oneshot::Canceled instead")]
#[cfg(feature = "with-deprecated")]
pub use sync::oneshot::Canceled;

#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "import through the future module instead")]
#[cfg(feature = "with-deprecated")]
#[allow(deprecated)]
pub use future::{BoxFuture, collect, select_all, select_ok};

#[doc(hidden)]
#[deprecated(since = "0.1.4", note = "import through the future module instead")]
#[cfg(feature = "with-deprecated")]
pub use future::{SelectAll, SelectAllNext, Collect, SelectOk};
}

/// A "prelude" for crates using the `futures` crate.
///
Expand Down
13 changes: 3 additions & 10 deletions src/sink/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,6 @@ pub trait Sink {
/// It is highly recommended to consider this method a required method and
/// to implement it whenever you implement `Sink` locally. It is especially
/// crucial to be sure to close inner sinks, if applicable.
#[cfg(feature = "with-deprecated")]
fn close(&mut self) -> Poll<(), Self::SinkError> {
self.poll_complete()
}

/// dox (you should see the above, not this)
#[cfg(not(feature = "with-deprecated"))]
fn close(&mut self) -> Poll<(), Self::SinkError>;

/// Creates a new object which will produce a synchronous sink.
Expand All @@ -292,7 +285,7 @@ pub trait Sink {
/// only has two methods: `send` and `flush`. These two methods correspond
/// to `start_send` and `poll_complete` above except are executed in a
/// blocking fashion.
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
fn wait(self) -> Wait<Self>
where Self: Sized
{
Expand Down Expand Up @@ -400,9 +393,9 @@ pub trait Sink {
/// Note that this function consumes the given sink, returning a wrapped
/// version, much like `Iterator::map`.
///
/// This method is only available when the `use_std` feature of this
/// This method is only available when the `std` feature of this
/// library is activated, and it is activated by default.
#[cfg(feature = "use_std")]
#[cfg(feature = "std")]
fn buffer(self, amt: usize) -> Buffer<Self>
where Self: Sized
{
Expand Down
Loading

0 comments on commit 18c4984

Please sign in to comment.