pub struct RawCommandClient { /* private fields */ }net only.Expand description
An unrestricted command-channel UDP client. Raw operations intentionally live on this
distinct type. The safe client can be converted into it only by consuming the idle client
with CommandClient::into_raw. A raw client can transmit arbitrary bytes, receive from
any peer, and change socket options; those operations carry no command validation or
transaction guarantee.
Implementations§
Source§impl RawCommandClient
impl RawCommandClient
Sourcepub fn bind(interface: Ipv4Addr, server: SocketAddrV4) -> Result<Self>
pub fn bind(interface: Ipv4Addr, server: SocketAddrV4) -> Result<Self>
Binds an unrestricted command socket to interface and records the default destination
server.
§Errors
Returns the operating-system error from binding the socket.
Sourcepub fn server(&self) -> SocketAddr
pub fn server(&self) -> SocketAddr
The configured default destination.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
The local address selected for this socket.
§Errors
Returns the operating-system error from querying the socket.
Sourcepub fn send(&self, datagram: &[u8]) -> Result<usize>
pub fn send(&self, datagram: &[u8]) -> Result<usize>
Sends arbitrary bytes to the configured default destination.
§Errors
Returns the operating-system send error.
Sourcepub fn recv(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
pub fn recv(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
Receives arbitrary bytes and returns their source address.
§Errors
Returns the operating-system receive error.
Sourcepub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>
Changes raw receive blocking behavior.
§Errors
Returns the operating-system error from changing the socket mode.
Sourcepub fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<()>
pub fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<()>
Changes the raw receive timeout.
§Errors
Returns the operating-system error from changing the timeout.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RawCommandClient
impl RefUnwindSafe for RawCommandClient
impl Send for RawCommandClient
impl Sync for RawCommandClient
impl Unpin for RawCommandClient
impl UnsafeUnpin for RawCommandClient
impl UnwindSafe for RawCommandClient
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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.