summaryrefslogtreecommitdiffhomepage
path: root/talpid-core/src
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-02-20 12:15:51 +0000
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2020-02-24 12:45:08 +0000
commit06159ad47e72016f2772166049f554a6d48a01ba (patch)
tree99530da8e7fe17ef37ff9604dc9ee4ea6d80a7d7 /talpid-core/src
parent76cd4dca9c5822458fbe94407d16c816ec6bd6a9 (diff)
downloadmullvadvpn-06159ad47e72016f2772166049f554a6d48a01ba.tar.xz
mullvadvpn-06159ad47e72016f2772166049f554a6d48a01ba.zip
Implement `Sender` for `IntoSender`
Diffstat (limited to 'talpid-core/src')
-rw-r--r--talpid-core/src/mpsc.rs8
-rw-r--r--talpid-core/src/tunnel_state_machine/mod.rs2
2 files changed, 5 insertions, 5 deletions
diff --git a/talpid-core/src/mpsc.rs b/talpid-core/src/mpsc.rs
index 8ac152a082..c3974c70be 100644
--- a/talpid-core/src/mpsc.rs
+++ b/talpid-core/src/mpsc.rs
@@ -1,4 +1,4 @@
-use futures::sync::mpsc::{SendError, UnboundedSender};
+use futures::sync::mpsc::UnboundedSender;
use std::marker::PhantomData;
/// Abstraction over any type that can be used similarly to an `std::mpsc::Sender`.
@@ -14,13 +14,13 @@ pub struct IntoSender<T, U> {
_marker: PhantomData<T>,
}
-impl<T, U> IntoSender<T, U>
+impl<T, U> Sender<T> for IntoSender<T, U>
where
T: Into<U>,
{
/// Converts the `T` into a `U` and sends it on the channel.
- pub fn send(&self, t: T) -> Result<(), SendError<U>> {
- self.sender.unbounded_send(t.into())
+ fn send(&self, item: T) -> Result<(), ()> {
+ self.sender.unbounded_send(item.into()).map_err(|_| ())
}
}
diff --git a/talpid-core/src/tunnel_state_machine/mod.rs b/talpid-core/src/tunnel_state_machine/mod.rs
index 3fb2e4e757..9f448f14ef 100644
--- a/talpid-core/src/tunnel_state_machine/mod.rs
+++ b/talpid-core/src/tunnel_state_machine/mod.rs
@@ -17,7 +17,7 @@ use self::{
use crate::{
dns::DnsMonitor,
firewall::{Firewall, FirewallArguments},
- mpsc::IntoSender,
+ mpsc::{IntoSender, Sender},
offline,
tunnel::tun_provider::TunProvider,
};