diff options
| -rw-r--r-- | talpid-core/src/mpsc.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/talpid-core/src/mpsc.rs b/talpid-core/src/mpsc.rs index 21807ca377..8ac152a082 100644 --- a/talpid-core/src/mpsc.rs +++ b/talpid-core/src/mpsc.rs @@ -1,6 +1,12 @@ use futures::sync::mpsc::{SendError, UnboundedSender}; use std::marker::PhantomData; +/// Abstraction over any type that can be used similarly to an `std::mpsc::Sender`. +pub trait Sender<T> { + /// Sends an item over the underlying channel, failing only if the channel is closed. + fn send(&self, item: T) -> Result<(), ()>; +} + /// Abstraction over an `mpsc::Sender` that first converts the value to another type before sending. #[derive(Debug, Clone)] pub struct IntoSender<T, U> { |
