From 4996f297788542074d6fe37675d059a70cad85b8 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 16 Jan 2020 10:30:27 +0900 Subject: [PATCH 01/14] feat: Add no-std feature --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index b1155bb..fbcf5f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,9 @@ std = [ "pin-project-lite", "pin-utils", "slab", + "no-std", ] +no-std = [] [dependencies] async-attributes = { version = "1.1.1", optional = true } From 51b84a7620823d8b1c081d0d1d994e95b2001f17 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 16 Jan 2020 10:31:27 +0900 Subject: [PATCH 02/14] feat: Add no_std attribute when not std feature --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index c9d1277..237d73f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -221,6 +221,7 @@ //! features = ["std"] //! ``` +#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(feature = "docs", feature(doc_cfg))] #![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)] #![allow(clippy::mutex_atomic, clippy::module_inception)] From 3d32fd81f4a2993086c97da6dad8a529c7c597f4 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 16 Jan 2020 10:33:00 +0900 Subject: [PATCH 03/14] feat: Make the utils module no_std --- src/utils.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index ef50ed0..ccf5e84 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,3 +1,9 @@ +#[cfg(feature = "no-std")] +extern crate alloc; + +#[cfg(feature = "no-std")] +use alloc::string::String; + /// Calls a function and aborts if it panics. /// /// This is useful in unsafe code where we can't recover from panics. @@ -104,6 +110,7 @@ macro_rules! cfg_unstable_default { /// Declares Unix-specific items. #[doc(hidden)] +#[allow(unused_macros)] macro_rules! cfg_unix { ($($item:item)*) => { $( @@ -116,6 +123,7 @@ macro_rules! cfg_unix { /// Declares Windows-specific items. #[doc(hidden)] +#[allow(unused_macros)] macro_rules! cfg_windows { ($($item:item)*) => { $( @@ -128,6 +136,7 @@ macro_rules! cfg_windows { /// Declares items when the "docs" feature is enabled. #[doc(hidden)] +#[allow(unused_macros)] macro_rules! cfg_docs { ($($item:item)*) => { $( @@ -139,6 +148,7 @@ macro_rules! cfg_docs { /// Declares items when the "docs" feature is disabled. #[doc(hidden)] +#[allow(unused_macros)] macro_rules! cfg_not_docs { ($($item:item)*) => { $( @@ -160,6 +170,18 @@ macro_rules! cfg_std { } } +/// Declares no-std items. +#[allow(unused_macros)] +#[doc(hidden)] +macro_rules! cfg_no_std { + ($($item:item)*) => { + $( + #[cfg(feature = "no-std")] + $item + )* + } +} + /// Declares default items. #[allow(unused_macros)] #[doc(hidden)] @@ -180,6 +202,7 @@ macro_rules! cfg_default { /// /// Inside invocations of this macro, we write a definitions that looks similar to the final /// rendered docs, and the macro then generates all the boilerplate for us. +#[allow(unused_macros)] #[doc(hidden)] macro_rules! extension_trait { ( @@ -204,14 +227,14 @@ macro_rules! extension_trait { #[allow(dead_code)] mod owned { #[doc(hidden)] - pub struct ImplFuture(std::marker::PhantomData); + pub struct ImplFuture(core::marker::PhantomData); } // A fake `impl Future` type that borrows its environment. #[allow(dead_code)] mod borrowed { #[doc(hidden)] - pub struct ImplFuture<'a, T>(std::marker::PhantomData<&'a T>); + pub struct ImplFuture<'a, T>(core::marker::PhantomData<&'a T>); } // Render a fake trait combining the bodies of the base trait and the extension trait. From 41f114d9fe17a9a0822570bfa4f90365b35f5d66 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 16 Jan 2020 10:37:22 +0900 Subject: [PATCH 04/14] ci: Add no-std check --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bee2562..0b0e84f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,7 @@ jobs: with: command: check args: --features unstable --all --bins --examples --tests + - name: check bench uses: actions-rs/cargo@v1 if: matrix.rust == 'nightly' @@ -53,6 +54,12 @@ jobs: command: check args: --no-default-features --features std + - name: check no_std + uses: actions-rs/cargo@v1 + with: + command: check + args: --no-default-features --features no-std + - name: check attributes uses: actions-rs/cargo@v1 with: From 6aa55fde59bea45c1e5e7184782c882a4259813f Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 16 Jan 2020 11:18:09 +0900 Subject: [PATCH 05/14] feat: Make the task module no_std --- Cargo.toml | 5 +++-- src/lib.rs | 5 ++++- src/task/mod.rs | 11 +++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fbcf5f4..4492048 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,6 @@ unstable = ["std", "broadcaster", "futures-timer"] attributes = ["async-attributes"] std = [ "crossbeam-utils", - "futures-core", "futures-io", "memchr", "once_cell", @@ -48,7 +47,9 @@ std = [ "slab", "no-std", ] -no-std = [] +no-std = [ + "futures-core", +] [dependencies] async-attributes = { version = "1.1.1", optional = true } diff --git a/src/lib.rs b/src/lib.rs index 237d73f..fc0755d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -241,6 +241,10 @@ pub use async_attributes::{main, test}; #[cfg(feature = "std")] mod macros; +cfg_no_std! { + pub mod task; +} + cfg_std! { pub mod future; pub mod io; @@ -248,7 +252,6 @@ cfg_std! { pub mod prelude; pub mod stream; pub mod sync; - pub mod task; } cfg_default! { diff --git a/src/task/mod.rs b/src/task/mod.rs index f738fca..680e2a5 100644 --- a/src/task/mod.rs +++ b/src/task/mod.rs @@ -117,13 +117,16 @@ //! [`task_local!`]: ../macro.task_local.html //! [`with`]: struct.LocalKey.html#method.with -cfg_std! { +cfg_no_std! { #[doc(inline)] - pub use std::task::{Context, Poll, Waker}; - + pub use core::task::{Context, Poll, Waker}; pub use ready::ready; - pub use yield_now::yield_now; + mod ready; +} + +cfg_std! { + pub use yield_now::yield_now; mod yield_now; } From 1762de285b8bd96eed278c6c0bf8b13edc5d0b62 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 16 Jan 2020 15:40:28 +0900 Subject: [PATCH 06/14] feat: Make the future module no_std --- src/future/future/mod.rs | 6 +++--- src/future/mod.rs | 21 +++++++++++++-------- src/lib.rs | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/future/future/mod.rs b/src/future/future/mod.rs index d610096..24f3fb5 100644 --- a/src/future/future/mod.rs +++ b/src/future/future/mod.rs @@ -21,8 +21,8 @@ cfg_unstable_default! { } extension_trait! { - use std::pin::Pin; - use std::ops::{Deref, DerefMut}; + use core::pin::Pin; + use core::ops::{Deref, DerefMut}; use crate::task::{Context, Poll}; @@ -136,7 +136,7 @@ extension_trait! { [`Future`]: ../future/trait.Future.html "#] - pub trait FutureExt: std::future::Future { + pub trait FutureExt: core::future::Future { /// Returns a Future that delays execution for a specified time. /// /// # Examples diff --git a/src/future/mod.rs b/src/future/mod.rs index 9936276..3d325be 100644 --- a/src/future/mod.rs +++ b/src/future/mod.rs @@ -46,15 +46,20 @@ //! [`Future::race`]: trait.Future.html#method.race //! [`Future::try_race`]: trait.Future.html#method.try_race -pub use future::Future; -pub use pending::pending; -pub use poll_fn::poll_fn; -pub use ready::ready; +cfg_no_std! { + pub use future::Future; + pub(crate) mod future; +} + +cfg_std! { + pub use pending::pending; + pub use poll_fn::poll_fn; + pub use ready::ready; -pub(crate) mod future; -mod pending; -mod poll_fn; -mod ready; + mod pending; + mod poll_fn; + mod ready; +} cfg_default! { pub use timeout::{timeout, TimeoutError}; diff --git a/src/lib.rs b/src/lib.rs index fc0755d..6fe13e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -243,10 +243,10 @@ mod macros; cfg_no_std! { pub mod task; + pub mod future; } cfg_std! { - pub mod future; pub mod io; pub mod os; pub mod prelude; From 880b7ee987576f24a6dceb955a96365479ae8101 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 16 Jan 2020 20:34:51 +0900 Subject: [PATCH 07/14] remove crate::prelude import --- src/stream/extend.rs | 2 +- src/stream/interval.rs | 4 ++-- src/stream/stream/chain.rs | 3 ++- src/stream/stream/cmp.rs | 4 ++-- src/stream/stream/eq.rs | 4 ++-- src/stream/stream/flat_map.rs | 2 +- src/stream/stream/ge.rs | 4 ++-- src/stream/stream/gt.rs | 4 ++-- src/stream/stream/le.rs | 4 ++-- src/stream/stream/lt.rs | 4 ++-- src/stream/stream/merge.rs | 3 ++- src/stream/stream/ne.rs | 4 ++-- src/stream/stream/partial_cmp.rs | 2 +- 13 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/stream/extend.rs b/src/stream/extend.rs index c48fe1e..fab8e6e 100644 --- a/src/stream/extend.rs +++ b/src/stream/extend.rs @@ -1,6 +1,6 @@ use std::pin::Pin; -use crate::prelude::*; +use crate::future::Future; use crate::stream::IntoStream; /// Extends a collection with the contents of a stream. diff --git a/src/stream/interval.rs b/src/stream/interval.rs index f8a6ef6..7a0c174 100644 --- a/src/stream/interval.rs +++ b/src/stream/interval.rs @@ -2,10 +2,10 @@ use std::pin::Pin; use std::task::{Context, Poll}; use std::time::{Duration, Instant}; +use crate::future::Future; +use crate::stream::Stream; use futures_timer::Delay; -use crate::prelude::*; - /// Creates a new stream that yields at a set interval. /// /// The stream first yields after `dur`, and continues to yield every diff --git a/src/stream/stream/chain.rs b/src/stream/stream/chain.rs index 909fc19..1d62f38 100644 --- a/src/stream/stream/chain.rs +++ b/src/stream/stream/chain.rs @@ -3,7 +3,8 @@ use std::pin::Pin; use pin_project_lite::pin_project; use super::fuse::Fuse; -use crate::prelude::*; +use crate::stream::stream::StreamExt; +use crate::stream::Stream; use crate::task::{Context, Poll}; pin_project! { diff --git a/src/stream/stream/cmp.rs b/src/stream/stream/cmp.rs index 2be0c1a..191219d 100644 --- a/src/stream/stream/cmp.rs +++ b/src/stream/stream/cmp.rs @@ -1,11 +1,11 @@ use std::cmp::Ordering; -use std::pin::Pin; use std::future::Future; +use std::pin::Pin; use pin_project_lite::pin_project; use super::fuse::Fuse; -use crate::prelude::*; +use crate::stream::stream::StreamExt; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/eq.rs b/src/stream/stream/eq.rs index 58ccc90..54745af 100644 --- a/src/stream/stream/eq.rs +++ b/src/stream/stream/eq.rs @@ -1,10 +1,10 @@ -use std::pin::Pin; use std::future::Future; +use std::pin::Pin; use pin_project_lite::pin_project; use super::fuse::Fuse; -use crate::prelude::*; +use crate::stream::stream::StreamExt; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/flat_map.rs b/src/stream/stream/flat_map.rs index 9a7d921..cc0f665 100644 --- a/src/stream/stream/flat_map.rs +++ b/src/stream/stream/flat_map.rs @@ -2,8 +2,8 @@ use std::pin::Pin; use pin_project_lite::pin_project; -use crate::prelude::*; use crate::stream::stream::map::Map; +use crate::stream::stream::StreamExt; use crate::stream::{IntoStream, Stream}; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/ge.rs b/src/stream/stream/ge.rs index 67b20be..50ea21d 100644 --- a/src/stream/stream/ge.rs +++ b/src/stream/stream/ge.rs @@ -1,11 +1,11 @@ use std::cmp::Ordering; -use std::pin::Pin; use std::future::Future; +use std::pin::Pin; use pin_project_lite::pin_project; use super::partial_cmp::PartialCmpFuture; -use crate::prelude::*; +use crate::stream::stream::StreamExt; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/gt.rs b/src/stream/stream/gt.rs index 1c12189..d42b8d4 100644 --- a/src/stream/stream/gt.rs +++ b/src/stream/stream/gt.rs @@ -1,11 +1,11 @@ use std::cmp::Ordering; -use std::pin::Pin; use std::future::Future; +use std::pin::Pin; use pin_project_lite::pin_project; use super::partial_cmp::PartialCmpFuture; -use crate::prelude::*; +use crate::stream::stream::StreamExt; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/le.rs b/src/stream/stream/le.rs index 7b86161..9ee44cb 100644 --- a/src/stream/stream/le.rs +++ b/src/stream/stream/le.rs @@ -1,11 +1,11 @@ use std::cmp::Ordering; -use std::pin::Pin; use std::future::Future; +use std::pin::Pin; use pin_project_lite::pin_project; use super::partial_cmp::PartialCmpFuture; -use crate::prelude::*; +use crate::stream::stream::StreamExt; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/lt.rs b/src/stream/stream/lt.rs index 100a003..4364ffe 100644 --- a/src/stream/stream/lt.rs +++ b/src/stream/stream/lt.rs @@ -1,11 +1,11 @@ use std::cmp::Ordering; -use std::pin::Pin; use std::future::Future; +use std::pin::Pin; use pin_project_lite::pin_project; use super::partial_cmp::PartialCmpFuture; -use crate::prelude::*; +use crate::stream::stream::StreamExt; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/merge.rs b/src/stream/stream/merge.rs index 84ac432..ad697a8 100644 --- a/src/stream/stream/merge.rs +++ b/src/stream/stream/merge.rs @@ -3,8 +3,9 @@ use std::task::{Context, Poll}; use pin_project_lite::pin_project; -use crate::prelude::*; +use crate::stream::stream::StreamExt; use crate::stream::Fuse; +use crate::stream::Stream; use crate::utils; pin_project! { diff --git a/src/stream/stream/ne.rs b/src/stream/stream/ne.rs index ec11d1f..7cad3b7 100644 --- a/src/stream/stream/ne.rs +++ b/src/stream/stream/ne.rs @@ -1,10 +1,10 @@ -use std::pin::Pin; use std::future::Future; +use std::pin::Pin; use pin_project_lite::pin_project; use super::fuse::Fuse; -use crate::prelude::*; +use crate::stream::stream::StreamExt; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/partial_cmp.rs b/src/stream/stream/partial_cmp.rs index 85587c9..247413b 100644 --- a/src/stream/stream/partial_cmp.rs +++ b/src/stream/stream/partial_cmp.rs @@ -5,7 +5,7 @@ use std::pin::Pin; use pin_project_lite::pin_project; use super::fuse::Fuse; -use crate::prelude::*; +use crate::stream::stream::StreamExt; use crate::stream::Stream; use crate::task::{Context, Poll}; From d622ec5d357ce8797fecdd480479ca92560e6c41 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 16 Jan 2020 21:01:47 +0900 Subject: [PATCH 08/14] feat: Make the stream module no_std --- Cargo.toml | 2 +- src/lib.rs | 2 +- src/stream/double_ended_stream/next_back.rs | 4 ++-- src/stream/double_ended_stream/nth_back.rs | 6 +++--- src/stream/double_ended_stream/rfind.rs | 6 +++--- src/stream/double_ended_stream/rfold.rs | 6 +++--- src/stream/double_ended_stream/try_rfold.rs | 2 +- src/stream/empty.rs | 4 ++-- src/stream/extend.rs | 2 +- src/stream/from_fn.rs | 2 +- src/stream/from_iter.rs | 2 +- src/stream/from_stream.rs | 4 ++-- src/stream/once.rs | 2 +- src/stream/pending.rs | 6 +++--- src/stream/product.rs | 4 ++-- src/stream/repeat.rs | 2 +- src/stream/repeat_with.rs | 2 +- src/stream/stream/all.rs | 6 +++--- src/stream/stream/any.rs | 6 +++--- src/stream/stream/chain.rs | 2 +- src/stream/stream/cloned.rs | 2 +- src/stream/stream/cmp.rs | 6 +++--- src/stream/stream/copied.rs | 2 +- src/stream/stream/count.rs | 4 ++-- src/stream/stream/cycle.rs | 4 ++-- src/stream/stream/delay.rs | 6 +++--- src/stream/stream/enumerate.rs | 2 +- src/stream/stream/eq.rs | 4 ++-- src/stream/stream/filter.rs | 2 +- src/stream/stream/filter_map.rs | 4 ++-- src/stream/stream/find.rs | 4 ++-- src/stream/stream/find_map.rs | 6 +++--- src/stream/stream/flat_map.rs | 2 +- src/stream/stream/flatten.rs | 4 ++-- src/stream/stream/fold.rs | 4 ++-- src/stream/stream/for_each.rs | 4 ++-- src/stream/stream/fuse.rs | 2 +- src/stream/stream/ge.rs | 6 +++--- src/stream/stream/gt.rs | 6 +++--- src/stream/stream/inspect.rs | 2 +- src/stream/stream/last.rs | 4 ++-- src/stream/stream/le.rs | 6 +++--- src/stream/stream/lt.rs | 6 +++--- src/stream/stream/map.rs | 2 +- src/stream/stream/max.rs | 8 ++++---- src/stream/stream/max_by.rs | 6 +++--- src/stream/stream/max_by_key.rs | 6 +++--- src/stream/stream/merge.rs | 4 ++-- src/stream/stream/min.rs | 8 ++++---- src/stream/stream/min_by.rs | 6 +++--- src/stream/stream/min_by_key.rs | 6 +++--- src/stream/stream/mod.rs | 8 ++++---- src/stream/stream/ne.rs | 4 ++-- src/stream/stream/next.rs | 4 ++-- src/stream/stream/nth.rs | 6 +++--- src/stream/stream/partial_cmp.rs | 6 +++--- src/stream/stream/partition.rs | 6 +++--- src/stream/stream/position.rs | 4 ++-- src/stream/stream/scan.rs | 2 +- src/stream/stream/skip.rs | 4 ++-- src/stream/stream/skip_while.rs | 2 +- src/stream/stream/step_by.rs | 2 +- src/stream/stream/take.rs | 2 +- src/stream/stream/take_while.rs | 2 +- src/stream/stream/timeout.rs | 2 +- src/stream/stream/try_fold.rs | 2 +- src/stream/stream/try_for_each.rs | 4 ++-- src/stream/stream/unzip.rs | 4 ++-- src/stream/stream/zip.rs | 4 ++-- src/stream/successors.rs | 4 ++-- src/stream/sum.rs | 4 ++-- 71 files changed, 143 insertions(+), 143 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4492048..1206129 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,13 +42,13 @@ std = [ "futures-io", "memchr", "once_cell", - "pin-project-lite", "pin-utils", "slab", "no-std", ] no-std = [ "futures-core", + "pin-project-lite", ] [dependencies] diff --git a/src/lib.rs b/src/lib.rs index 6fe13e6..f35d6cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -244,13 +244,13 @@ mod macros; cfg_no_std! { pub mod task; pub mod future; + pub mod stream; } cfg_std! { pub mod io; pub mod os; pub mod prelude; - pub mod stream; pub mod sync; } diff --git a/src/stream/double_ended_stream/next_back.rs b/src/stream/double_ended_stream/next_back.rs index aa642d0..9fb52b7 100644 --- a/src/stream/double_ended_stream/next_back.rs +++ b/src/stream/double_ended_stream/next_back.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; -use std::future::Future; +use core::pin::Pin; +use core::future::Future; use crate::stream::DoubleEndedStream; use crate::task::{Context, Poll}; diff --git a/src/stream/double_ended_stream/nth_back.rs b/src/stream/double_ended_stream/nth_back.rs index e32a28f..2701e9b 100644 --- a/src/stream/double_ended_stream/nth_back.rs +++ b/src/stream/double_ended_stream/nth_back.rs @@ -1,6 +1,6 @@ -use std::future::Future; -use std::pin::Pin; -use std::task::{Context, Poll}; +use core::future::Future; +use core::pin::Pin; +use core::task::{Context, Poll}; use crate::stream::DoubleEndedStream; diff --git a/src/stream/double_ended_stream/rfind.rs b/src/stream/double_ended_stream/rfind.rs index 9472693..3666551 100644 --- a/src/stream/double_ended_stream/rfind.rs +++ b/src/stream/double_ended_stream/rfind.rs @@ -1,6 +1,6 @@ -use std::task::{Context, Poll}; -use std::future::Future; -use std::pin::Pin; +use core::task::{Context, Poll}; +use core::future::Future; +use core::pin::Pin; use crate::stream::DoubleEndedStream; diff --git a/src/stream/double_ended_stream/rfold.rs b/src/stream/double_ended_stream/rfold.rs index 9002f8d..9bc1878 100644 --- a/src/stream/double_ended_stream/rfold.rs +++ b/src/stream/double_ended_stream/rfold.rs @@ -1,6 +1,6 @@ -use std::future::Future; -use std::pin::Pin; -use std::task::{Context, Poll}; +use core::future::Future; +use core::pin::Pin; +use core::task::{Context, Poll}; use pin_project_lite::pin_project; diff --git a/src/stream/double_ended_stream/try_rfold.rs b/src/stream/double_ended_stream/try_rfold.rs index 9e6295a..d67b6ec 100644 --- a/src/stream/double_ended_stream/try_rfold.rs +++ b/src/stream/double_ended_stream/try_rfold.rs @@ -1,5 +1,5 @@ use crate::future::Future; -use std::pin::Pin; +use core::pin::Pin; use crate::task::{Context, Poll}; use pin_project_lite::pin_project; diff --git a/src/stream/empty.rs b/src/stream/empty.rs index 4909070..a11337a 100644 --- a/src/stream/empty.rs +++ b/src/stream/empty.rs @@ -1,5 +1,5 @@ -use std::marker::PhantomData; -use std::pin::Pin; +use core::marker::PhantomData; +use core::pin::Pin; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/extend.rs b/src/stream/extend.rs index fab8e6e..dbf7911 100644 --- a/src/stream/extend.rs +++ b/src/stream/extend.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use crate::future::Future; use crate::stream::IntoStream; diff --git a/src/stream/from_fn.rs b/src/stream/from_fn.rs index 8067176..d373645 100644 --- a/src/stream/from_fn.rs +++ b/src/stream/from_fn.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/from_iter.rs b/src/stream/from_iter.rs index 705d150..ea2ed8e 100644 --- a/src/stream/from_iter.rs +++ b/src/stream/from_iter.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/from_stream.rs b/src/stream/from_stream.rs index 67b9b3d..12d89e8 100644 --- a/src/stream/from_stream.rs +++ b/src/stream/from_stream.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use crate::stream::IntoStream; diff --git a/src/stream/once.rs b/src/stream/once.rs index 939722d..b86f181 100644 --- a/src/stream/once.rs +++ b/src/stream/once.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/pending.rs b/src/stream/pending.rs index 922a540..edb6be4 100644 --- a/src/stream/pending.rs +++ b/src/stream/pending.rs @@ -1,6 +1,6 @@ -use std::marker::PhantomData; -use std::pin::Pin; -use std::task::{Context, Poll}; +use core::marker::PhantomData; +use core::pin::Pin; +use core::task::{Context, Poll}; use crate::stream::{DoubleEndedStream, ExactSizeStream, FusedStream, Stream}; diff --git a/src/stream/product.rs b/src/stream/product.rs index 2f5bf4c..15497e8 100644 --- a/src/stream/product.rs +++ b/src/stream/product.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; -use std::future::Future; +use core::pin::Pin; +use core::future::Future; use crate::stream::Stream; diff --git a/src/stream/repeat.rs b/src/stream/repeat.rs index f3dfdbd..e73a2f8 100644 --- a/src/stream/repeat.rs +++ b/src/stream/repeat.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/repeat_with.rs b/src/stream/repeat_with.rs index e183a77..39984a3 100644 --- a/src/stream/repeat_with.rs +++ b/src/stream/repeat_with.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/all.rs b/src/stream/stream/all.rs index d2ac5ca..06f4d7f 100644 --- a/src/stream/stream/all.rs +++ b/src/stream/stream/all.rs @@ -1,6 +1,6 @@ -use std::marker::PhantomData; -use std::pin::Pin; -use std::future::Future; +use core::marker::PhantomData; +use core::pin::Pin; +use core::future::Future; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/any.rs b/src/stream/stream/any.rs index 34168e6..15154c5 100644 --- a/src/stream/stream/any.rs +++ b/src/stream/stream/any.rs @@ -1,6 +1,6 @@ -use std::marker::PhantomData; -use std::pin::Pin; -use std::future::Future; +use core::marker::PhantomData; +use core::pin::Pin; +use core::future::Future; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/chain.rs b/src/stream/stream/chain.rs index 1d62f38..c034a53 100644 --- a/src/stream/stream/chain.rs +++ b/src/stream/stream/chain.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/cloned.rs b/src/stream/stream/cloned.rs index 4c77c5c..eac992d 100644 --- a/src/stream/stream/cloned.rs +++ b/src/stream/stream/cloned.rs @@ -1,7 +1,7 @@ use crate::stream::Stream; use crate::task::{Context, Poll}; use pin_project_lite::pin_project; -use std::pin::Pin; +use core::pin::Pin; pin_project! { /// A stream that clones the elements of an underlying stream. diff --git a/src/stream/stream/cmp.rs b/src/stream/stream/cmp.rs index 191219d..9d2b0ec 100644 --- a/src/stream/stream/cmp.rs +++ b/src/stream/stream/cmp.rs @@ -1,6 +1,6 @@ -use std::cmp::Ordering; -use std::future::Future; -use std::pin::Pin; +use core::cmp::Ordering; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/copied.rs b/src/stream/stream/copied.rs index 651c31b..19296f5 100644 --- a/src/stream/stream/copied.rs +++ b/src/stream/stream/copied.rs @@ -1,7 +1,7 @@ use crate::stream::Stream; use crate::task::{Context, Poll}; use pin_project_lite::pin_project; -use std::pin::Pin; +use core::pin::Pin; pin_project! { /// A stream that copies the elements of an underlying stream. diff --git a/src/stream/stream/count.rs b/src/stream/stream/count.rs index 1ca8aef..63e0449 100644 --- a/src/stream/stream/count.rs +++ b/src/stream/stream/count.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/cycle.rs b/src/stream/stream/cycle.rs index 5f8eaa2..ef46d1a 100644 --- a/src/stream/stream/cycle.rs +++ b/src/stream/stream/cycle.rs @@ -1,5 +1,5 @@ -use std::mem::ManuallyDrop; -use std::pin::Pin; +use core::mem::ManuallyDrop; +use core::pin::Pin; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/delay.rs b/src/stream/stream/delay.rs index 5768792..ff4c937 100644 --- a/src/stream/stream/delay.rs +++ b/src/stream/stream/delay.rs @@ -1,6 +1,6 @@ -use std::future::Future; -use std::pin::Pin; -use std::time::Duration; +use core::future::Future; +use core::pin::Pin; +use core::time::Duration; use pin_project_lite::pin_project; diff --git a/src/stream/stream/enumerate.rs b/src/stream/stream/enumerate.rs index c4a37d6..093fefb 100644 --- a/src/stream/stream/enumerate.rs +++ b/src/stream/stream/enumerate.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/eq.rs b/src/stream/stream/eq.rs index 54745af..3d8307b 100644 --- a/src/stream/stream/eq.rs +++ b/src/stream/stream/eq.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/filter.rs b/src/stream/stream/filter.rs index 00344b0..2dc7dd4 100644 --- a/src/stream/stream/filter.rs +++ b/src/stream/stream/filter.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/filter_map.rs b/src/stream/stream/filter_map.rs index 3cd1e47..e43e8f0 100644 --- a/src/stream/stream/filter_map.rs +++ b/src/stream/stream/filter_map.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; -use std::task::{Context, Poll}; +use core::pin::Pin; +use core::task::{Context, Poll}; use pin_project_lite::pin_project; diff --git a/src/stream/stream/find.rs b/src/stream/stream/find.rs index 4a0749b..8652ac0 100644 --- a/src/stream/stream/find.rs +++ b/src/stream/stream/find.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/find_map.rs b/src/stream/stream/find_map.rs index c794943..f7e3c1e 100644 --- a/src/stream/stream/find_map.rs +++ b/src/stream/stream/find_map.rs @@ -1,6 +1,6 @@ -use std::future::Future; -use std::pin::Pin; -use std::task::{Context, Poll}; +use core::future::Future; +use core::pin::Pin; +use core::task::{Context, Poll}; use crate::stream::Stream; diff --git a/src/stream/stream/flat_map.rs b/src/stream/stream/flat_map.rs index cc0f665..e07893a 100644 --- a/src/stream/stream/flat_map.rs +++ b/src/stream/stream/flat_map.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/flatten.rs b/src/stream/stream/flatten.rs index 1d6fcae..f2e275c 100644 --- a/src/stream/stream/flatten.rs +++ b/src/stream/stream/flatten.rs @@ -1,5 +1,5 @@ -use std::fmt; -use std::pin::Pin; +use core::fmt; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/fold.rs b/src/stream/stream/fold.rs index a346eb6..3938a37 100644 --- a/src/stream/stream/fold.rs +++ b/src/stream/stream/fold.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/for_each.rs b/src/stream/stream/for_each.rs index dce5cda..dbada10 100644 --- a/src/stream/stream/for_each.rs +++ b/src/stream/stream/for_each.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; -use std::future::Future; +use core::pin::Pin; +use core::future::Future; use pin_project_lite::pin_project; diff --git a/src/stream/stream/fuse.rs b/src/stream/stream/fuse.rs index c7449c2..f3a0596 100644 --- a/src/stream/stream/fuse.rs +++ b/src/stream/stream/fuse.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/ge.rs b/src/stream/stream/ge.rs index 50ea21d..1e1b70d 100644 --- a/src/stream/stream/ge.rs +++ b/src/stream/stream/ge.rs @@ -1,6 +1,6 @@ -use std::cmp::Ordering; -use std::future::Future; -use std::pin::Pin; +use core::cmp::Ordering; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/gt.rs b/src/stream/stream/gt.rs index d42b8d4..d58e7e9 100644 --- a/src/stream/stream/gt.rs +++ b/src/stream/stream/gt.rs @@ -1,6 +1,6 @@ -use std::cmp::Ordering; -use std::future::Future; -use std::pin::Pin; +use core::cmp::Ordering; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/inspect.rs b/src/stream/stream/inspect.rs index bb39662..481810d 100644 --- a/src/stream/stream/inspect.rs +++ b/src/stream/stream/inspect.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/last.rs b/src/stream/stream/last.rs index d037efc..ebf1a48 100644 --- a/src/stream/stream/last.rs +++ b/src/stream/stream/last.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/le.rs b/src/stream/stream/le.rs index 9ee44cb..169f9ec 100644 --- a/src/stream/stream/le.rs +++ b/src/stream/stream/le.rs @@ -1,6 +1,6 @@ -use std::cmp::Ordering; -use std::future::Future; -use std::pin::Pin; +use core::cmp::Ordering; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/lt.rs b/src/stream/stream/lt.rs index 4364ffe..1851b8e 100644 --- a/src/stream/stream/lt.rs +++ b/src/stream/stream/lt.rs @@ -1,6 +1,6 @@ -use std::cmp::Ordering; -use std::future::Future; -use std::pin::Pin; +use core::cmp::Ordering; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/map.rs b/src/stream/stream/map.rs index 8e074a7..0eab3ce 100644 --- a/src/stream/stream/map.rs +++ b/src/stream/stream/map.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/max.rs b/src/stream/stream/max.rs index d8ff119..8a4d594 100644 --- a/src/stream/stream/max.rs +++ b/src/stream/stream/max.rs @@ -1,7 +1,7 @@ -use std::cmp::{Ord, Ordering}; -use std::marker::PhantomData; -use std::pin::Pin; -use std::future::Future; +use core::cmp::{Ord, Ordering}; +use core::marker::PhantomData; +use core::pin::Pin; +use core::future::Future; use pin_project_lite::pin_project; diff --git a/src/stream/stream/max_by.rs b/src/stream/stream/max_by.rs index 36b876b..8f98645 100644 --- a/src/stream/stream/max_by.rs +++ b/src/stream/stream/max_by.rs @@ -1,6 +1,6 @@ -use std::cmp::Ordering; -use std::pin::Pin; -use std::future::Future; +use core::cmp::Ordering; +use core::pin::Pin; +use core::future::Future; use pin_project_lite::pin_project; diff --git a/src/stream/stream/max_by_key.rs b/src/stream/stream/max_by_key.rs index e421f94..8fa91ab 100644 --- a/src/stream/stream/max_by_key.rs +++ b/src/stream/stream/max_by_key.rs @@ -1,6 +1,6 @@ -use std::cmp::Ordering; -use std::future::Future; -use std::pin::Pin; +use core::cmp::Ordering; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/merge.rs b/src/stream/stream/merge.rs index ad697a8..2320972 100644 --- a/src/stream/stream/merge.rs +++ b/src/stream/stream/merge.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; -use std::task::{Context, Poll}; +use core::pin::Pin; +use core::task::{Context, Poll}; use pin_project_lite::pin_project; diff --git a/src/stream/stream/min.rs b/src/stream/stream/min.rs index 4ce52be..4fe2a67 100644 --- a/src/stream/stream/min.rs +++ b/src/stream/stream/min.rs @@ -1,7 +1,7 @@ -use std::cmp::{Ord, Ordering}; -use std::marker::PhantomData; -use std::pin::Pin; -use std::future::Future; +use core::cmp::{Ord, Ordering}; +use core::marker::PhantomData; +use core::pin::Pin; +use core::future::Future; use pin_project_lite::pin_project; diff --git a/src/stream/stream/min_by.rs b/src/stream/stream/min_by.rs index e35719e..fe1d40e 100644 --- a/src/stream/stream/min_by.rs +++ b/src/stream/stream/min_by.rs @@ -1,6 +1,6 @@ -use std::cmp::Ordering; -use std::pin::Pin; -use std::future::Future; +use core::cmp::Ordering; +use core::pin::Pin; +use core::future::Future; use pin_project_lite::pin_project; diff --git a/src/stream/stream/min_by_key.rs b/src/stream/stream/min_by_key.rs index 07c3642..549b798 100644 --- a/src/stream/stream/min_by_key.rs +++ b/src/stream/stream/min_by_key.rs @@ -1,6 +1,6 @@ -use std::cmp::Ordering; -use std::future::Future; -use std::pin::Pin; +use core::cmp::Ordering; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/mod.rs b/src/stream/stream/mod.rs index 6c84ac2..d0cc718 100644 --- a/src/stream/stream/mod.rs +++ b/src/stream/stream/mod.rs @@ -110,12 +110,12 @@ pub use take::Take; pub use take_while::TakeWhile; pub use zip::Zip; -use std::cmp::Ordering; +use core::cmp::Ordering; cfg_unstable! { - use std::future::Future; - use std::pin::Pin; - use std::time::Duration; + use core::future::Future; + use core::pin::Pin; + use core::time::Duration; use crate::stream::into_stream::IntoStream; use crate::stream::{FromStream, Product, Sum}; diff --git a/src/stream/stream/ne.rs b/src/stream/stream/ne.rs index 7cad3b7..c51ab31 100644 --- a/src/stream/stream/ne.rs +++ b/src/stream/stream/ne.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/next.rs b/src/stream/stream/next.rs index 23abb0b..7bd2083 100644 --- a/src/stream/stream/next.rs +++ b/src/stream/stream/next.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; -use std::future::Future; +use core::pin::Pin; +use core::future::Future; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/nth.rs b/src/stream/stream/nth.rs index 267bd40..8cdabb6 100644 --- a/src/stream/stream/nth.rs +++ b/src/stream/stream/nth.rs @@ -1,6 +1,6 @@ -use std::pin::Pin; -use std::task::{Context, Poll}; -use std::future::Future; +use core::pin::Pin; +use core::task::{Context, Poll}; +use core::future::Future; use crate::stream::Stream; diff --git a/src/stream/stream/partial_cmp.rs b/src/stream/stream/partial_cmp.rs index 247413b..928a03b 100644 --- a/src/stream/stream/partial_cmp.rs +++ b/src/stream/stream/partial_cmp.rs @@ -1,6 +1,6 @@ -use std::cmp::Ordering; -use std::future::Future; -use std::pin::Pin; +use core::cmp::Ordering; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/partition.rs b/src/stream/stream/partition.rs index aaf58ac..69268ec 100644 --- a/src/stream/stream/partition.rs +++ b/src/stream/stream/partition.rs @@ -1,7 +1,7 @@ use pin_project_lite::pin_project; -use std::default::Default; -use std::future::Future; -use std::pin::Pin; +use core::default::Default; +use core::future::Future; +use core::pin::Pin; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/position.rs b/src/stream/stream/position.rs index df60eaa..2811b6d 100644 --- a/src/stream/stream/position.rs +++ b/src/stream/stream/position.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/scan.rs b/src/stream/stream/scan.rs index 385edf8..d72b0dc 100644 --- a/src/stream/stream/scan.rs +++ b/src/stream/stream/scan.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/skip.rs b/src/stream/stream/skip.rs index bcff50d..52b137d 100644 --- a/src/stream/stream/skip.rs +++ b/src/stream/stream/skip.rs @@ -1,5 +1,5 @@ -use std::pin::Pin; -use std::task::{Context, Poll}; +use core::pin::Pin; +use core::task::{Context, Poll}; use pin_project_lite::pin_project; diff --git a/src/stream/stream/skip_while.rs b/src/stream/stream/skip_while.rs index 2334713..d139de4 100644 --- a/src/stream/stream/skip_while.rs +++ b/src/stream/stream/skip_while.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/step_by.rs b/src/stream/stream/step_by.rs index 2149cda..3dd3d62 100644 --- a/src/stream/stream/step_by.rs +++ b/src/stream/stream/step_by.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/take.rs b/src/stream/stream/take.rs index 8c85227..ffc3e99 100644 --- a/src/stream/stream/take.rs +++ b/src/stream/stream/take.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/take_while.rs b/src/stream/stream/take_while.rs index 2ba8490..60eb8c5 100644 --- a/src/stream/stream/take_while.rs +++ b/src/stream/stream/take_while.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/timeout.rs b/src/stream/stream/timeout.rs index f580360..ce658c8 100644 --- a/src/stream/stream/timeout.rs +++ b/src/stream/stream/timeout.rs @@ -1,8 +1,8 @@ use std::error::Error; use std::fmt; +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; diff --git a/src/stream/stream/try_fold.rs b/src/stream/stream/try_fold.rs index 3b92d95..73312ff 100644 --- a/src/stream/stream/try_fold.rs +++ b/src/stream/stream/try_fold.rs @@ -1,4 +1,4 @@ -use std::pin::Pin; +use core::pin::Pin; use crate::future::Future; use crate::stream::Stream; diff --git a/src/stream/stream/try_for_each.rs b/src/stream/stream/try_for_each.rs index 86f1674..917bfd1 100644 --- a/src/stream/stream/try_for_each.rs +++ b/src/stream/stream/try_for_each.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/stream/unzip.rs b/src/stream/stream/unzip.rs index cb57578..7771509 100644 --- a/src/stream/stream/unzip.rs +++ b/src/stream/stream/unzip.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/stream/zip.rs b/src/stream/stream/zip.rs index 597691b..83d613c 100644 --- a/src/stream/stream/zip.rs +++ b/src/stream/stream/zip.rs @@ -1,5 +1,5 @@ -use std::fmt; -use std::pin::Pin; +use core::fmt; +use core::pin::Pin; use pin_project_lite::pin_project; diff --git a/src/stream/successors.rs b/src/stream/successors.rs index 4421564..a9ce40f 100644 --- a/src/stream/successors.rs +++ b/src/stream/successors.rs @@ -1,5 +1,5 @@ -use std::mem; -use std::pin::Pin; +use core::mem; +use core::pin::Pin; use crate::stream::Stream; use crate::task::{Context, Poll}; diff --git a/src/stream/sum.rs b/src/stream/sum.rs index 9607baf..3b3144e 100644 --- a/src/stream/sum.rs +++ b/src/stream/sum.rs @@ -1,5 +1,5 @@ -use std::future::Future; -use std::pin::Pin; +use core::future::Future; +use core::pin::Pin; use crate::stream::Stream; From 22d929d481b8748111a51907be1ca716a95c183c Mon Sep 17 00:00:00 2001 From: k-nasa Date: Thu, 16 Jan 2020 21:13:23 +0900 Subject: [PATCH 09/14] fix import Future --- src/stream/extend.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stream/extend.rs b/src/stream/extend.rs index dbf7911..702cbca 100644 --- a/src/stream/extend.rs +++ b/src/stream/extend.rs @@ -1,6 +1,6 @@ use core::pin::Pin; +use core::future::Future; -use crate::future::Future; use crate::stream::IntoStream; /// Extends a collection with the contents of a stream. From 7efe7caf66012ae6eb92e667f372f7a6ad6bd282 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Tue, 28 Jan 2020 15:58:06 +0900 Subject: [PATCH 10/14] fix: Change feature name no-std to alloc --- .github/workflows/ci.yml | 2 +- Cargo.toml | 4 ++-- src/future/mod.rs | 2 +- src/lib.rs | 2 +- src/task/mod.rs | 2 +- src/utils.rs | 8 ++++---- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b0e84f..597c2b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: check - args: --no-default-features --features no-std + args: --no-default-features --features alloc - name: check attributes uses: actions-rs/cargo@v1 diff --git a/Cargo.toml b/Cargo.toml index 1206129..da6187a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,9 +44,9 @@ std = [ "once_cell", "pin-utils", "slab", - "no-std", + "alloc", ] -no-std = [ +alloc = [ "futures-core", "pin-project-lite", ] diff --git a/src/future/mod.rs b/src/future/mod.rs index 3d325be..9b75533 100644 --- a/src/future/mod.rs +++ b/src/future/mod.rs @@ -46,7 +46,7 @@ //! [`Future::race`]: trait.Future.html#method.race //! [`Future::try_race`]: trait.Future.html#method.try_race -cfg_no_std! { +cfg_alloc! { pub use future::Future; pub(crate) mod future; } diff --git a/src/lib.rs b/src/lib.rs index f35d6cb..b5a3fff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -241,7 +241,7 @@ pub use async_attributes::{main, test}; #[cfg(feature = "std")] mod macros; -cfg_no_std! { +cfg_alloc! { pub mod task; pub mod future; pub mod stream; diff --git a/src/task/mod.rs b/src/task/mod.rs index 680e2a5..13fe903 100644 --- a/src/task/mod.rs +++ b/src/task/mod.rs @@ -117,7 +117,7 @@ //! [`task_local!`]: ../macro.task_local.html //! [`with`]: struct.LocalKey.html#method.with -cfg_no_std! { +cfg_alloc! { #[doc(inline)] pub use core::task::{Context, Poll, Waker}; pub use ready::ready; diff --git a/src/utils.rs b/src/utils.rs index ccf5e84..e257d2f 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,7 +1,7 @@ -#[cfg(feature = "no-std")] +#[cfg(feature = "alloc")] extern crate alloc; -#[cfg(feature = "no-std")] +#[cfg(feature = "alloc")] use alloc::string::String; /// Calls a function and aborts if it panics. @@ -173,10 +173,10 @@ macro_rules! cfg_std { /// Declares no-std items. #[allow(unused_macros)] #[doc(hidden)] -macro_rules! cfg_no_std { +macro_rules! cfg_alloc { ($($item:item)*) => { $( - #[cfg(feature = "no-std")] + #[cfg(feature = "alloc")] $item )* } From ef985bc72ef770b338480769cdf5ce42edcbc7b8 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Sat, 1 Feb 2020 09:45:41 +0900 Subject: [PATCH 11/14] ci: fix no_std ci --- .github/workflows/ci.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 597c2b6..e99f508 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,12 +54,6 @@ jobs: command: check args: --no-default-features --features std - - name: check no_std - uses: actions-rs/cargo@v1 - with: - command: check - args: --no-default-features --features alloc - - name: check attributes uses: actions-rs/cargo@v1 with: @@ -78,6 +72,22 @@ jobs: command: test args: --doc --features "unstable attributes" + build__with_no_std: + name: Build with no-std + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + + - name: setup + run: rustup target add thumbv7m-none-eabi + + - name: check no_std + uses: actions-rs/cargo@v1 + with: + command: check + args: --no-default-features --features alloc --target thumbv7m-none-eabi -v + check_fmt_and_docs: name: Checking fmt and docs runs-on: ubuntu-latest From f789f9d4f68af64eaee47c0db931de5632a294f3 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Sat, 1 Feb 2020 09:47:33 +0900 Subject: [PATCH 12/14] Select future-core featue according to feature --- Cargo.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index da6187a..6ae4d82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,16 +38,17 @@ docs = ["attributes", "unstable", "default"] unstable = ["std", "broadcaster", "futures-timer"] attributes = ["async-attributes"] std = [ + "alloc", "crossbeam-utils", + "futures-core/std", "futures-io", "memchr", "once_cell", "pin-utils", "slab", - "alloc", ] alloc = [ - "futures-core", + "futures-core/alloc", "pin-project-lite", ] @@ -58,7 +59,7 @@ broadcaster = { version = "1.0.0", optional = true } crossbeam-channel = { version = "0.4.0", optional = true } crossbeam-deque = { version = "0.7.2", optional = true } crossbeam-utils = { version = "0.7.0", optional = true } -futures-core = { version = "0.3.1", optional = true } +futures-core = { version = "0.3.1", optional = true, default-features = false } futures-io = { version = "0.3.1", optional = true } futures-timer = { version = "2.0.2", optional = true } kv-log-macro = { version = "1.0.4", optional = true } From 0d90cb07b9afa8d741100483020be79b4acd6409 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Sat, 1 Feb 2020 09:49:54 +0900 Subject: [PATCH 13/14] fix: Move `extern crate alloc` to lib.rs --- src/lib.rs | 2 ++ src/utils.rs | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b5a3fff..05073a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -230,6 +230,8 @@ #![doc(html_logo_url = "https://async.rs/images/logo--hero.svg")] #![recursion_limit = "2048"] +extern crate alloc; + #[macro_use] mod utils; diff --git a/src/utils.rs b/src/utils.rs index e257d2f..f18b74d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,7 +1,3 @@ -#[cfg(feature = "alloc")] -extern crate alloc; - -#[cfg(feature = "alloc")] use alloc::string::String; /// Calls a function and aborts if it panics. From 3e24e0ba4ed99c185013a26eb0943cf00037429e Mon Sep 17 00:00:00 2001 From: k-nasa Date: Sat, 1 Feb 2020 16:43:12 +0900 Subject: [PATCH 14/14] ci: fix no-std check --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e99f508..bcda990 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,13 +80,15 @@ jobs: - uses: actions/checkout@master - name: setup - run: rustup target add thumbv7m-none-eabi + run: | + rustup default nightly + rustup target add thumbv7m-none-eabi - name: check no_std uses: actions-rs/cargo@v1 with: command: check - args: --no-default-features --features alloc --target thumbv7m-none-eabi -v + args: --no-default-features --features alloc --target thumbv7m-none-eabi -Z avoid-dev-deps check_fmt_and_docs: name: Checking fmt and docs