Compare commits

...

8 Commits

Author SHA1 Message Date
nasa 1b67cdfa52
Merge 3883079fa5 into 8947d8e03c 2024-02-12 20:33:17 +00:00
Marc-Antoine Perennou 8947d8e03c
Merge pull request #1069 from Keruspe/update-deps 2024-02-12 10:39:05 +01:00
Marc-Antoine Perennou bbde18ffbd fix CI for recent rustc
Allow for unused `pub use` in experimental API which doesn't have its mods public for noiw.
MIPS CI is fully broken (doesn't find the MIPS toolchain) so disable it for now.
Reenable powerpc64 which is no longer broken
2023-11-23 15:01:15 +01:00
Marc-Antoine Perennou 1adaa09626 update async-* dependencies
Don't update async-channel as Receiver is now `!Unpin`.
2023-11-23 15:01:07 +01:00
k-nasa 3883079fa5 feat: to no_std future module 2020-02-04 19:04:53 +09:00
k-nasa 3b9c7f0958 feat: to no_std future::ready 2020-02-04 19:04:53 +09:00
k-nasa 94a6ff34c2 feat: no to_std future::poll_fn 2020-02-04 19:04:53 +09:00
k-nasa da23d16019 feat: to no_std future::pending 2020-02-04 19:04:53 +09:00
12 changed files with 65 additions and 30 deletions

View File

@ -132,8 +132,8 @@ jobs:
target:
- i686-unknown-linux-gnu
- powerpc-unknown-linux-gnu
# - powerpc64-unknown-linux-gnu
- mips-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
# - mips-unknown-linux-gnu
- arm-linux-androideabi
steps:

View File

@ -62,7 +62,7 @@ io_safety = []
[dependencies]
async-attributes = { version = "1.1.2", optional = true }
async-lock = { version = "2.7.0", optional = true }
async-lock = { version = "3.1.0", optional = true }
crossbeam-utils = { version = "0.8.0", optional = true }
futures-core = { version = "0.3.4", optional = true, default-features = false }
futures-io = { version = "0.3.4", optional = true }
@ -80,10 +80,10 @@ surf = { version = "2.0.0", optional = true }
[target.'cfg(not(target_os = "unknown"))'.dependencies]
async-global-executor = { version = "2.3.1", optional = true, features = ["async-io"] }
async-io = { version = "1.13.0", optional = true }
futures-lite = { version = "1.0.0", optional = true }
async-process = { version = "1.7.0", optional = true }
async-global-executor = { version = "2.4.0", optional = true, features = ["async-io"] }
async-io = { version = "2.2.0", optional = true }
futures-lite = { version = "2.0.0", optional = true }
async-process = { version = "2.0.0", optional = true }
[target.'cfg(target_arch = "wasm32")'.dependencies]
gloo-timers = { version = "0.2.1", features = ["futures"], optional = true }

View File

@ -11,10 +11,17 @@ pub mod hash_set;
pub mod linked_list;
pub mod vec_deque;
#[allow(unused)]
pub use binary_heap::BinaryHeap;
#[allow(unused)]
pub use btree_map::BTreeMap;
#[allow(unused)]
pub use btree_set::BTreeSet;
#[allow(unused)]
pub use hash_map::HashMap;
#[allow(unused)]
pub use hash_set::HashSet;
#[allow(unused)]
pub use linked_list::LinkedList;
#[allow(unused)]
pub use vec_deque::VecDeque;

View File

@ -48,17 +48,14 @@
cfg_alloc! {
pub use future::Future;
pub(crate) mod future;
}
cfg_std! {
pub use ready::ready;
pub use pending::pending;
pub use poll_fn::poll_fn;
pub use ready::ready;
pub(crate) mod future;
mod ready;
mod pending;
mod poll_fn;
mod ready;
}
#[cfg(any(feature = "unstable", feature = "default"))]

View File

@ -1,6 +1,6 @@
use std::future::Future;
use std::marker::PhantomData;
use std::pin::Pin;
use core::future::Future;
use core::marker::PhantomData;
use core::pin::Pin;
use crate::task::{Context, Poll};
@ -24,14 +24,17 @@ use crate::task::{Context, Poll};
/// #
/// # })
/// ```
pub async fn pending<T>() -> T {
let fut = Pending {
pub fn pending<T>() -> Pending<T> {
Pending {
_marker: PhantomData,
};
fut.await
}
}
struct Pending<T> {
/// This future is constructed by the [`pending`] function.
///
/// [`pending`]: fn.pending.html
#[derive(Debug)]
pub struct Pending<T> {
_marker: PhantomData<T>,
}

View File

@ -1,5 +1,5 @@
use std::pin::Pin;
use std::future::Future;
use core::future::Future;
use core::pin::Pin;
use crate::task::{Context, Poll};
@ -23,15 +23,18 @@ use crate::task::{Context, Poll};
/// #
/// # })
/// ```
pub async fn poll_fn<F, T>(f: F) -> T
pub fn poll_fn<F, T>(f: F) -> PollFn<F>
where
F: FnMut(&mut Context<'_>) -> Poll<T>,
{
let fut = PollFn { f };
fut.await
PollFn { f }
}
struct PollFn<F> {
/// This future is constructed by the [`poll_fn`] function.
///
/// [`poll_fn`]: fn.poll_fn.html
#[derive(Debug)]
pub struct PollFn<F> {
f: F,
}

View File

@ -1,3 +1,8 @@
use core::future::Future;
use core::pin::Pin;
use crate::task::{Context, Poll};
/// Resolves to the provided value.
///
/// This function is an async version of [`std::convert::identity`].
@ -15,6 +20,22 @@
/// #
/// # })
/// ```
pub async fn ready<T>(val: T) -> T {
val
pub fn ready<T>(val: T) -> Ready<T> {
Ready(Some(val))
}
/// This future is constructed by the [`ready`] function.
///
/// [`ready`]: fn.ready.html
#[derive(Debug)]
pub struct Ready<T>(Option<T>);
impl<T> Unpin for Ready<T> {}
impl<T> Future for Ready<T> {
type Output = T;
fn poll(mut self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<T> {
Poll::Ready(self.0.take().unwrap())
}
}

View File

@ -5,6 +5,7 @@
mod from_stream;
#[allow(unused)]
#[doc(inline)]
pub use std::option::Option;

View File

@ -5,6 +5,7 @@
mod from_stream;
#[allow(unused)]
#[doc(inline)]
pub use std::result::Result;

View File

@ -5,5 +5,6 @@
mod extend;
mod from_stream;
#[allow(unused)]
#[doc(inline)]
pub use std::string::String;

View File

@ -149,7 +149,7 @@ impl WakerSet {
/// Returns `true` if at least one operation was notified.
#[cold]
fn notify(&self, n: Notify) -> bool {
let mut inner = &mut *self.lock();
let inner = &mut *self.lock();
let mut notified = false;
for (_, opt_waker) in inner.entries.iter_mut() {

View File

@ -6,5 +6,6 @@
mod extend;
mod from_stream;
#[allow(unused)]
#[doc(inline)]
pub use std::vec::Vec;