[−][src]Struct oni_simulator::Socket
Simulated unreliable unordered connectionless UDP-like socket.
Methods
impl<MTU: ArrayLength<u8>> Socket<MTU>
[src]
impl<MTU: ArrayLength<u8>> Socket<MTU>
pub fn take_send_bytes(&self) -> usize
[src]
pub fn take_send_bytes(&self) -> usize
Takes the value of the counter sent bytes and clear counter.
pub fn take_recv_bytes(&self) -> usize
[src]
pub fn take_recv_bytes(&self) -> usize
Takes the value of the counter received bytes and clear counter.
pub fn local_addr(&self) -> SocketAddr
[src]
pub fn local_addr(&self) -> SocketAddr
Returns the socket address that this socket was created from.
pub fn send_to(&self, buf: &[u8], addr: SocketAddr) -> Result<usize>
[src]
pub fn send_to(&self, buf: &[u8], addr: SocketAddr) -> Result<usize>
Sends data on the socket to the given address. On success, returns the number of bytes written.
This will return an error when the length of buf
is greater than MTU
.
pub fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
[src]
pub fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
Receives a single datagram message on the socket. On success, returns the number of bytes read and the origin.
The function must be called with valid byte array buf
of sufficient size to hold the message bytes.
If a message is too long to fit in the supplied buffer, excess bytes may be discarded.
Trait Implementations
impl<MTU: ArrayLength<u8>> Drop for Socket<MTU>
[src]
impl<MTU: ArrayLength<u8>> Drop for Socket<MTU>
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self