Skip to content

Commit 4863a6c

Browse files
committed
remove flume
1 parent d43c2bf commit 4863a6c

File tree

3 files changed

+8
-42
lines changed

3 files changed

+8
-42
lines changed

Cargo.lock

Lines changed: 0 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pulsebeam-runtime/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ rustls = "0.23.31"
2525
turmoil = "0.6.6"
2626
quinn-udp = "0.5.14"
2727
socket2 = "0.6.0"
28-
flume = "0.11.1"
2928
no-panic = "0.1.35"
3029

3130
[dev-dependencies]

pulsebeam-runtime/src/mailbox.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<T: fmt::Debug> Error for TrySendError<T> {}
3636

3737
/// A handle to send messages to an actor's mailbox.
3838
pub struct Sender<T> {
39-
sender: flume::Sender<T>,
39+
sender: tokio::sync::mpsc::Sender<T>,
4040
}
4141

4242
impl<T> Clone for Sender<T> {
@@ -53,9 +53,9 @@ impl<T> Sender<T> {
5353
/// Returns a `SendError` only if the receiving actor has terminated.
5454
pub async fn send(&mut self, message: T) -> Result<(), SendError<T>> {
5555
self.sender
56-
.send_async(message)
56+
.send(message)
5757
.await
58-
.map_err(|flume::SendError(e)| SendError(e))
58+
.map_err(|tokio::sync::mpsc::error::SendError(e)| SendError(e))
5959
}
6060

6161
/// Attempts to immediately send a message.
@@ -64,27 +64,27 @@ impl<T> Sender<T> {
6464
/// receiving actor has terminated.
6565
pub fn try_send(&mut self, message: T) -> Result<(), TrySendError<T>> {
6666
self.sender.try_send(message).map_err(|e| match e {
67-
flume::TrySendError::Full(e) => TrySendError::Full(e),
68-
flume::TrySendError::Disconnected(e) => TrySendError::Closed(e),
67+
tokio::sync::mpsc::error::TrySendError::Full(e) => TrySendError::Full(e),
68+
tokio::sync::mpsc::error::TrySendError::Closed(e) => TrySendError::Closed(e),
6969
})
7070
}
7171
}
7272

7373
/// An actor's mailbox for receiving messages.
7474
pub struct Receiver<T> {
75-
receiver: flume::Receiver<T>,
75+
receiver: tokio::sync::mpsc::Receiver<T>,
7676
}
7777

7878
impl<T> Receiver<T> {
7979
/// Receives the next message from the mailbox.
8080
pub async fn recv(&mut self) -> Option<T> {
81-
self.receiver.recv_async().await.ok()
81+
self.receiver.recv().await
8282
}
8383
}
8484

8585
/// Creates a new mailbox and a corresponding sender handle.
8686
pub fn new<T>(buffer: usize) -> (Sender<T>, Receiver<T>) {
87-
let (sender, receiver) = flume::bounded(buffer);
87+
let (sender, receiver) = tokio::sync::mpsc::channel(buffer);
8888
(Sender { sender }, Receiver { receiver })
8989
}
9090

0 commit comments

Comments
 (0)