diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-08-20 14:33:11 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-08-20 14:33:11 +0200 |
commit | 7e727d120b4c7375b7dd2f1210a883c876531c06 (patch) | |
tree | 43b30640038535c9f3d6640659707c5fd36b595b /src/types/udp.rs | |
parent | Implemented keypair_confirm (diff) | |
download | wireguard-rs-7e727d120b4c7375b7dd2f1210a883c876531c06.tar.xz wireguard-rs-7e727d120b4c7375b7dd2f1210a883c876531c06.zip |
Restructure and job stealing work queue
Diffstat (limited to '')
-rw-r--r-- | src/types/udp.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/types/udp.rs b/src/types/udp.rs index f45cf85..00e218f 100644 --- a/src/types/udp.rs +++ b/src/types/udp.rs @@ -1,26 +1,27 @@ +use super::Endpoint; use std::error; /* Often times an a file descriptor in an atomic might suffice. */ -pub trait Bind<Endpoint>: Send + Sync { - type Error : error::Error; +pub trait Bind: Send + Sync { + type Error: error::Error; + type Endpoint: Endpoint; fn new() -> Self; /// Updates the port of the Bind - /// + /// /// # Arguments - /// + /// /// - port, The new port to bind to. 0 means any available port. - /// + /// /// # Returns - /// + /// /// The unit type or an error, if binding fails fn set_port(&self, port: u16) -> Result<(), Self::Error>; /// Returns the current port of the bind fn get_port(&self) -> u16; - - fn recv(&self, dst: &mut [u8]) -> Endpoint; - fn send(&self, src: &[u8], dst: &Endpoint); + fn recv(&self, dst: &mut [u8]) -> Self::Endpoint; + fn send(&self, src: &[u8], dst: &Self::Endpoint); } |