Struct cross_socket::socket::Socket
source · pub struct Socket { /* private fields */ }
Expand description
Socket. Provides cross-platform adapter for system’s socket.
Implementations§
source§impl Socket
impl Socket
sourcepub fn new(socket_option: SocketOption) -> Result<Socket>
pub fn new(socket_option: SocketOption) -> Result<Socket>
Constructs a new Socket
sourcepub fn receive_from(&self, buf: &mut Vec<u8>) -> Result<(usize, SocketAddr)>
pub fn receive_from(&self, buf: &mut Vec<u8>) -> Result<(usize, SocketAddr)>
Receive packet with sender address
sourcepub fn bind(&self, addr: SocketAddr) -> Result<()>
pub fn bind(&self, addr: SocketAddr) -> Result<()>
Bind socket to address
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Socket
impl Send for Socket
impl Sync for Socket
impl Unpin for Socket
impl UnwindSafe for Socket
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more