[−][src]Struct abbegm::sync_peer::EgmPeer
Blocking EGM peer for sending and receiving messages over UDP.
Implementations
impl EgmPeer
[src]
pub fn new(socket: UdpSocket) -> Self
[src]
Wrap an existing UDP socket in a peer.
If you want to use the EgmPeer::recv
and EgmPeer::send
functions,
you should use an already connected socket.
Otherwise, you can only use EgmPeer::recv_from
and EgmPeer::send_to
.
pub fn bind(addrs: impl ToSocketAddrs) -> Result<Self>
[src]
Create an EGM peer on a newly bound UDP socket.
The socket will not be connected to a remote peer,
so you can only use EgmPeer::recv_from
and EgmPeer::send_to
.
pub fn socket(&self) -> &UdpSocket
[src]
Get a shared reference to the inner socket.
pub fn socket_mut(&mut self) -> &mut UdpSocket
[src]
Get an exclusive reference to the inner socket.
pub fn into_socket(self) -> UdpSocket
[src]
Consume self and get the inner socket.
pub fn recv(&mut self) -> Result<EgmRobot, ReceiveError>
[src]
Receive a message from the remote address to which the inner socket is connected.
To use this function, you must pass an already connected socket to EgmPeer::new
.
If the peer was created with an unconnected socket, this function will panic.
pub fn recv_from(&mut self) -> Result<(EgmRobot, SocketAddr), ReceiveError>
[src]
Receive a message from any remote address.
pub fn purge_recv_queue(&mut self) -> Result<()>
[src]
Purge all messages from the socket read queue.
Useful to ignore old messages when the socket has been left unpolled for a while.
This will leave the socket in blocking mode when the purging is done.
pub fn send(&mut self, msg: &EgmSensor) -> Result<(), SendError>
[src]
Send a message to the remote address to which the inner socket is connected.
To use this function, you must pass an already connected socket to EgmPeer::new
.
If the peer was created with an unconnected socket, this function will panic.
pub fn send_to(
&mut self,
msg: &EgmSensor,
target: &SocketAddr
) -> Result<(), SendError>
[src]
&mut self,
msg: &EgmSensor,
target: &SocketAddr
) -> Result<(), SendError>
Send a message to the specified address.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for EgmPeer
impl Send for EgmPeer
impl Sync for EgmPeer
impl Unpin for EgmPeer
impl UnwindSafe for EgmPeer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,