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,10 +1,6 @@
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use async_std::fs;
use async_std::fs::File;
use async_std::io::ReadExt;
use async_std::path::{Path, PathBuf};
use async_std::stream::StreamExt;
use futures::FutureExt;
use itertools::Itertools;
use orchid_base::error::{OrcRes, Reporter, async_io_err, mk_errv, os_str_to_string};
@@ -17,6 +13,8 @@ use orchid_host::parse::{HostParseCtxImpl, parse_items};
use orchid_host::parsed::ParsedModule;
use orchid_host::tree::Root;
use substack::Substack;
use tokio::fs::{self, File};
use tokio::io::AsyncReadExt;
pub async fn parse_folder(
root: &Root,
@@ -30,7 +28,7 @@ pub async fn parse_folder(
return Ok(root.add_parsed(&parsed_module, ns, rep).await);
async fn recur(path: &Path, ns: Sym, rep: &Reporter, ctx: Ctx) -> OrcRes<Option<ParsedModule>> {
let sr = SrcRange::new(0..0, &ns);
if path.is_dir().await {
if path.is_dir() {
let Some(name_os) = path.file_name() else {
return Err(mk_errv(
ctx.i.i("Could not read directory name").await,
@@ -46,9 +44,10 @@ pub async fn parse_folder(
Err(err) => return Err(async_io_err(err, &ctx.i, [sr]).await),
Ok(s) => s,
};
while let Some(entry_res) = stream.next().await {
let entry = match entry_res {
Ok(ent) => ent,
loop {
let entry = match stream.next_entry().await {
Ok(Some(ent)) => ent,
Ok(None) => break,
Err(err) => {
rep.report(async_io_err(err, &ctx.i, [sr.clone()]).await);
continue;