[−][src]Struct abbegm::tokio_peer::EgmPeer
Asynchronous EGM peer capable of sending and receiving messages.
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 async 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 bind_sync(addrs: impl ToSocketAddrs) -> Result<Self>
[src]
Synchronously create an EGM peer on a newly bound UDP socket.
This function allows you to create the peer synchronously, but use an asynchronous API for communicating with the robot. This can be useful if you want to perform initialization of your application synchronously.
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 async fn recv<'_>(&'_ 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 async fn recv_from<'_>(
&'_ self
) -> Result<(EgmRobot, SocketAddr), ReceiveError>
[src]
&'_ self
) -> Result<(EgmRobot, SocketAddr), ReceiveError>
Receive a message from any remote address.
pub async fn purge_read_queue<'_>(&'_ self) -> Result<()>
[src]
Purge all messages from the socket read queue.
pub async fn send<'_, '_>(
&'_ mut self,
msg: &'_ EgmSensor
) -> Result<(), SendError>
[src]
&'_ mut self,
msg: &'_ EgmSensor
) -> Result<(), SendError>
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 async 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>,