diff --git a/Cargo.toml b/Cargo.toml index 2a9f748..5028776 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "moro" version = "0.4.0" -edition = "2021" +edition = "2024" license = "MIT OR Apache-2.0" repository = "https://github.com/nikomatsakis/moro" readme = "README.md" diff --git a/examples/hello_world.rs b/examples/hello_world.rs index f87d9ce..f65cff3 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -1,5 +1,3 @@ -#![feature(async_closure)] - #[tokio::main] pub async fn main() { let value = 22; diff --git a/src/async_iter.rs b/src/async_iter.rs index 3fc0178..30d4833 100644 --- a/src/async_iter.rs +++ b/src/async_iter.rs @@ -17,7 +17,7 @@ pub trait AsyncIterator { fn filter( self, - op: impl async FnMut(&Self::Item) -> bool, + op: impl AsyncFnMut(&Self::Item) -> bool, ) -> impl AsyncIterator where Self: Sized, @@ -53,7 +53,7 @@ impl IntoAsyncIter for T { struct Filter where I: AsyncIterator, - O: async FnMut(&I::Item) -> bool, + O: AsyncFnMut(&I::Item) -> bool, { iter: I, filter_op: O, @@ -62,7 +62,7 @@ where impl AsyncIterator for Filter where I: AsyncIterator, - O: async FnMut(&I::Item) -> bool, + O: AsyncFnMut(&I::Item) -> bool, { type Item = I::Item; diff --git a/src/body.rs b/src/body.rs index 81959f3..915a95d 100644 --- a/src/body.rs +++ b/src/body.rs @@ -1,6 +1,5 @@ -use std::{pin::Pin, sync::Arc, task::Poll}; +use std::{future::Future, pin::Pin, sync::Arc, task::Poll}; -use futures::{Future, FutureExt}; use pin_project::{pin_project, pinned_drop}; use crate::scope::Scope; diff --git a/src/lib.rs b/src/lib.rs index 63a7438..e1c1ac2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(async_closure)] #![feature(async_fn_traits)] #![feature(unboxed_closures)] #![allow(async_fn_in_trait)] @@ -174,7 +173,7 @@ pub fn scope<'env, R, B>( ) -> ScopeBody<'env, R, ,)>>::CallOnceFuture> where R: Send + 'env, - for<'scope> B: async FnOnce(&'scope Scope<'scope, 'env, R>) -> R, + for<'scope> B: AsyncFnOnce(&'scope Scope<'scope, 'env, R>) -> R, { let scope = Scope::new(); diff --git a/src/stream.rs b/src/stream.rs index f23b771..6818969 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -1,7 +1,7 @@ use crate::{AsyncIterator, IntoAsyncIter, Scope}; pub trait Stream: IntoAsyncIter { - fn filter(self, op: impl async FnMut(&Self::Item) -> bool) -> impl Stream + fn filter(self, op: impl AsyncFnMut(&Self::Item) -> bool) -> impl Stream where Self: Sized, { @@ -11,20 +11,20 @@ pub trait Stream: IntoAsyncIter { } } - async fn for_each(&mut self, mut op: impl async FnMut(Self::Item)) + async fn for_each(&mut self, mut op: impl AsyncFnMut(Self::Item)) where Self: Sized, { self.fold((), async |(), item| op(item).await).await } - async fn fold(&mut self, start: R, op: impl async FnMut(R, Self::Item) -> R) -> R; + async fn fold(&mut self, start: R, op: impl AsyncFnMut(R, Self::Item) -> R) -> R; } struct Filter where S: Stream, - O: async FnMut(&S::Item) -> bool, + O: AsyncFnMut(&S::Item) -> bool, { stream: S, filter_op: O, @@ -33,9 +33,9 @@ where impl Stream for Filter where S: Stream, - O: async FnMut(&S::Item) -> bool, + O: AsyncFnMut(&S::Item) -> bool, { - async fn fold(&mut self, start: R, mut op: impl async FnMut(R, Self::Item) -> R) -> R { + async fn fold(&mut self, start: R, mut op: impl AsyncFnMut(R, Self::Item) -> R) -> R { self.stream .fold(start, async |acc, item| { if (self.filter_op)(&item).await { @@ -51,7 +51,7 @@ where impl IntoAsyncIter for Filter where S: Stream, - O: async FnMut(&S::Item) -> bool, + O: AsyncFnMut(&S::Item) -> bool, { type Item = S::Item;