Phased out async-stream in pursuit of compile performance

This commit is contained in:
2025-09-04 15:01:53 +02:00
parent 088cb6a247
commit e339350505
26 changed files with 359 additions and 342 deletions

View File

@@ -6,11 +6,11 @@ edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
async-fn-stream = { version = "0.1.0", path = "../async-fn-stream" }
async-once-cell = "0.5.4"
async-stream = "0.3.6"
derive_destructure = "1.0.0"
dyn-clone = "1.0.20"
futures = { version = "0.3.31", features = ["std"] }
futures = { version = "0.3.31", features = ["std"], default-features = false }
hashbrown = "0.16.0"
itertools = "0.14.0"
lazy_static = "1.5.0"

View File

@@ -4,7 +4,7 @@ use std::future::Future;
use std::marker::PhantomData;
use std::rc::Rc;
use async_stream::stream;
use async_fn_stream::stream;
use futures::future::join_all;
use futures::{FutureExt, StreamExt};
use itertools::Itertools;
@@ -195,11 +195,11 @@ pub async fn ttv_from_api<H: ExprRepr, X: ExtraTok>(
src: &Sym,
i: &Interner,
) -> Vec<TokTree<H, X>> {
stream! {
stream(async |mut cx| {
for tok in tokv {
yield TokTree::<H, X>::from_api(tok.borrow(), hctx, xctx, src, i).boxed_local().await
cx.emit(TokTree::<H, X>::from_api(tok.borrow(), hctx, xctx, src, i).boxed_local().await).await
}
}
})
.collect()
.await
}
@@ -209,11 +209,11 @@ pub async fn ttv_into_api<H: ExprRepr, X: ExtraTok>(
hctx: &mut H::ToApiCtx<'_>,
xctx: &mut X::ToApiCtx<'_>,
) -> Vec<api::TokenTree> {
stream! {
stream(async |mut cx| {
for tok in tokv {
yield tok.into_api(hctx, xctx).await
cx.emit(tok.into_api(hctx, xctx).await).await
}
}
})
.collect()
.await
}