Trait iotscape::SocketTrait

source ·
pub trait SocketTrait: Sized {
    // Required methods
    fn bind(addrs: &[SocketAddr]) -> Result<Self, String>;
    fn send_to(&self, buf: &[u8], addr: SocketAddr) -> Result<usize, String>;
    fn recv(&mut self, buf: &mut [u8]) -> Result<usize, String>;
    fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<(), String>;
    fn set_write_timeout(&self, timeout: Option<Duration>) -> Result<(), String>;
}
Expand description

Trait to allow various socket types to be used with IoTScapeService

Required Methods§

source

fn bind(addrs: &[SocketAddr]) -> Result<Self, String>

source

fn send_to(&self, buf: &[u8], addr: SocketAddr) -> Result<usize, String>

source

fn recv(&mut self, buf: &mut [u8]) -> Result<usize, String>

source

fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<(), String>

source

fn set_write_timeout(&self, timeout: Option<Duration>) -> Result<(), String>

Implementations on Foreign Types§

source§

impl SocketTrait for UdpSocket

source§

fn bind(addrs: &[SocketAddr]) -> Result<Self, String>

source§

fn send_to(&self, buf: &[u8], addr: SocketAddr) -> Result<usize, String>

source§

fn recv(&mut self, buf: &mut [u8]) -> Result<usize, String>

source§

fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<(), String>

source§

fn set_write_timeout(&self, timeout: Option<Duration>) -> Result<(), String>

Implementors§