Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 0 additions & 2 deletions examples/hello_world.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(async_closure)]

#[tokio::main]
pub async fn main() {
let value = 22;
Expand Down
6 changes: 3 additions & 3 deletions src/async_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item = Self::Item>
where
Self: Sized,
Expand Down Expand Up @@ -53,7 +53,7 @@ impl<T: AsyncIterator> IntoAsyncIter for T {
struct Filter<I, O>
where
I: AsyncIterator,
O: async FnMut(&I::Item) -> bool,
O: AsyncFnMut(&I::Item) -> bool,
{
iter: I,
filter_op: O,
Expand All @@ -62,7 +62,7 @@ where
impl<I, O> AsyncIterator for Filter<I, O>
where
I: AsyncIterator,
O: async FnMut(&I::Item) -> bool,
O: AsyncFnMut(&I::Item) -> bool,
{
type Item = I::Item;

Expand Down
3 changes: 1 addition & 2 deletions src/body.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(async_closure)]
#![feature(async_fn_traits)]
#![feature(unboxed_closures)]
#![allow(async_fn_in_trait)]
Expand Down Expand Up @@ -174,7 +173,7 @@ pub fn scope<'env, R, B>(
) -> ScopeBody<'env, R, <B as AsyncFnOnce<(&'env scope::Scope<'env, '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();

Expand Down
14 changes: 7 additions & 7 deletions src/stream.rs
Original file line number Diff line number Diff line change
@@ -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<Item = Self::Item>
fn filter(self, op: impl AsyncFnMut(&Self::Item) -> bool) -> impl Stream<Item = Self::Item>
where
Self: Sized,
{
Expand All @@ -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<R>(&mut self, start: R, op: impl async FnMut(R, Self::Item) -> R) -> R;
async fn fold<R>(&mut self, start: R, op: impl AsyncFnMut(R, Self::Item) -> R) -> R;
}

struct Filter<S, O>
where
S: Stream,
O: async FnMut(&S::Item) -> bool,
O: AsyncFnMut(&S::Item) -> bool,
{
stream: S,
filter_op: O,
Expand All @@ -33,9 +33,9 @@ where
impl<S, O> Stream for Filter<S, O>
where
S: Stream,
O: async FnMut(&S::Item) -> bool,
O: AsyncFnMut(&S::Item) -> bool,
{
async fn fold<R>(&mut self, start: R, mut op: impl async FnMut(R, Self::Item) -> R) -> R {
async fn fold<R>(&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 {
Expand All @@ -51,7 +51,7 @@ where
impl<S, O> IntoAsyncIter for Filter<S, O>
where
S: Stream,
O: async FnMut(&S::Item) -> bool,
O: AsyncFnMut(&S::Item) -> bool,
{
type Item = S::Item;

Expand Down