updated all deps

migrated away from paste and async-std
This commit is contained in:
2025-09-03 18:42:54 +02:00
parent 7031f3a7d8
commit 088cb6a247
44 changed files with 569 additions and 456 deletions

View File

@@ -5,12 +5,12 @@ use std::num::NonZeroU64;
use std::pin::pin;
use std::rc::{Rc, Weak};
use async_std::channel::{self, Sender};
use async_std::sync::Mutex;
use async_stream::stream;
use derive_destructure::destructure;
use futures::channel::mpsc::{Sender, channel};
use futures::future::{join, join_all};
use futures::{StreamExt, stream};
use futures::lock::Mutex;
use futures::{SinkExt, StreamExt, stream};
use hashbrown::HashMap;
use itertools::Itertools;
use orchid_api_traits::Request;
@@ -45,12 +45,12 @@ pub struct ExtensionData {
next_pars: RefCell<NonZeroU64>,
exprs: ExprStore,
exiting_snd: Sender<()>,
lex_recur: Mutex<HashMap<api::ParsId, channel::Sender<ReqPair<api::SubLex>>>>,
lex_recur: Mutex<HashMap<api::ParsId, Sender<ReqPair<api::SubLex>>>>,
}
impl Drop for ExtensionData {
fn drop(&mut self) {
let reqnot = self.reqnot.clone();
let exiting_snd = self.exiting_snd.clone();
let mut exiting_snd = self.exiting_snd.clone();
(self.ctx.spawn)(Box::pin(async move {
reqnot.notify(api::HostExtNotif::Exit).await;
exiting_snd.send(()).await.unwrap()
@@ -64,7 +64,7 @@ impl Extension {
pub fn new(init: ExtInit, logger: Logger, msg_logger: Logger, ctx: Ctx) -> io::Result<Self> {
Ok(Self(Rc::new_cyclic(|weak: &Weak<ExtensionData>| {
let init = Rc::new(init);
let (exiting_snd, exiting_rcv) = channel::bounded::<()>(1);
let (exiting_snd, exiting_rcv) = channel::<()>(0);
(ctx.spawn)(clone!(init, weak, ctx; Box::pin(async move {
let rcv_stream = stream! { loop { yield init.recv().await } };
let mut event_stream = pin!(stream::select(exiting_rcv.map(|()| None), rcv_stream));
@@ -147,13 +147,14 @@ impl Extension {
hand.handle(fw, &sys.request(body.clone()).await).await
},
api::ExtHostReq::SubLex(sl) => {
let (rep_in, rep_out) = channel::bounded(1);
let (rep_in, mut rep_out) = channel(0);
{
let lex_g = this.0.lex_recur.lock().await;
let req_in = lex_g.get(&sl.id).expect("Sublex for nonexistent lexid");
let mut req_in =
lex_g.get(&sl.id).cloned().expect("Sublex for nonexistent lexid");
req_in.send(ReqPair(sl.clone(), rep_in)).await.unwrap();
}
hand.handle(&sl, &rep_out.recv().await.unwrap()).await
hand.handle(&sl, &rep_out.next().await.unwrap()).await
},
api::ExtHostReq::ExprReq(api::ExprReq::Inspect(
ins @ api::Inspect { target },
@@ -265,7 +266,7 @@ impl Extension {
// get unique lex ID
let id = api::ParsId(self.next_pars());
// create and register channel
let (req_in, req_out) = channel::bounded(1);
let (req_in, mut req_out) = channel(0);
self.0.lex_recur.lock().await.insert(id, req_in); // lex_recur released
let (ret, ()) = join(
async {
@@ -277,7 +278,7 @@ impl Extension {
res
},
async {
while let Ok(ReqPair(sublex, rep_in)) = req_out.recv().await {
while let Some(ReqPair(sublex, mut rep_in)) = req_out.next().await {
(rep_in.send(r(sublex.pos).await).await)
.expect("Response channel dropped while request pending")
}