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

@@ -8,11 +8,12 @@ use std::pin::Pin;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use async_std::channel;
use async_std::sync::Mutex;
use derive_destructure::destructure;
use dyn_clone::{DynClone, clone_box};
use futures::channel::mpsc;
use futures::future::LocalBoxFuture;
use futures::lock::Mutex;
use futures::{SinkExt, StreamExt};
use hashbrown::HashMap;
use orchid_api_traits::{Channel, Coding, Decode, Encode, MsgSet, Request};
use trait_set::trait_set;
@@ -102,7 +103,7 @@ pub struct ReqNotData<T: MsgSet> {
send: Box<dyn SendFn<T>>,
notif: Box<dyn NotifFn<T>>,
req: Box<dyn ReqFn<T>>,
responses: HashMap<u64, channel::Sender<Vec<u8>>>,
responses: HashMap<u64, mpsc::Sender<Vec<u8>>>,
}
/// Wraps a raw message buffer to save on copying.
@@ -144,7 +145,7 @@ impl<T: MsgSet> ReqNot<T> {
let notif_val = <T::In as Channel>::Notif::decode(Pin::new(&mut &payload[..])).await;
notif_cb(notif_val, self.clone()).await
} else if 0 < id.bitand(1 << 63) {
let sender = g.responses.remove(&!id).expect("Received response for invalid message");
let mut sender = g.responses.remove(&!id).expect("Received response for invalid message");
sender.send(message.to_vec()).await.unwrap()
} else {
let message = <T::In as Channel>::Req::decode(Pin::new(&mut &payload[..])).await;
@@ -205,13 +206,13 @@ impl<T: MsgSet> DynRequester for ReqNot<T> {
g.id += 1;
let mut buf = id.to_be_bytes().to_vec();
req.encode(Pin::new(&mut buf)).await;
let (send, recv) = channel::bounded(1);
let (send, mut recv) = mpsc::channel(1);
g.responses.insert(id, send);
let mut send = clone_box(&*g.send);
mem::drop(g);
let rn = self.clone();
send(&buf, rn).await;
let items = recv.recv().await;
let items = recv.next().await;
RawReply(items.unwrap())
})
}
@@ -249,8 +250,8 @@ mod test {
use std::rc::Rc;
use std::sync::Arc;
use async_std::sync::Mutex;
use futures::FutureExt;
use futures::lock::Mutex;
use orchid_api::LogStrategy;
use orchid_api_derive::Coding;
use orchid_api_traits::{Channel, Request};