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

@@ -1,6 +1,6 @@
use std::marker::PhantomData;
use async_stream::stream;
use async_fn_stream::stream;
use futures::future::{LocalBoxFuture, join_all};
use futures::{FutureExt, Stream, StreamExt};
use itertools::Itertools;
@@ -218,14 +218,15 @@ impl ConstCtx {
sys: self.ctx.sys_id(),
names: names.into_iter().map(|n| n.to_api()).collect_vec(),
};
stream! {
stream(async |mut cx| {
for name_opt in self.ctx.reqnot().request(resolve_names).await {
yield match name_opt {
cx.emit(match name_opt {
Err(e) => Err(OrcErrv::from_api(&e, self.ctx.i()).await),
Ok(name) => Ok(Sym::from_api(name, self.ctx.i()).await)
}
Ok(name) => Ok(Sym::from_api(name, self.ctx.i()).await),
})
.await
}
}
})
}
pub async fn names_n<const N: usize>(&self, names: [&Sym; N]) -> [OrcRes<Sym>; N] {
self.names(names).collect::<Vec<_>>().await.try_into().expect("Lengths must match")