pub struct UdpLink { /* private fields */ }Expand description
Implementations§
Source§impl UdpLink
impl UdpLink
Sourcepub async fn bind(local: impl ToSocketAddrs) -> Result<Self>
pub async fn bind(local: impl ToSocketAddrs) -> Result<Self>
Binds a local address and learns the peer from the first datagram received.
Read before writing in this mode: a write before any datagram has arrived has no peer to send to. This suits a vehicle configured to send its telemetry to this port.
§Arguments
local- the local address to bind, such as"0.0.0.0:14550".
§Returns
The bound link, with no peer yet.
§Errors
Returns an io::Error if the address cannot be bound.
Sourcepub async fn connect(
local: impl ToSocketAddrs,
remote: SocketAddr,
) -> Result<Self>
pub async fn connect( local: impl ToSocketAddrs, remote: SocketAddr, ) -> Result<Self>
Binds a local address and sets a fixed peer to send to.
This suits talking to a vehicle at a known address, such as PX4’s offboard UDP port.
§Arguments
local- the local address to bind, such as"0.0.0.0:0".remote- the vehicle’s address to send to.
§Returns
The link, ready to send.
§Errors
Returns an io::Error if the address cannot be bound.
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for UdpLink
impl RefUnwindSafe for UdpLink
impl Send for UdpLink
impl Sync for UdpLink
impl Unpin for UdpLink
impl UnsafeUnpin for UdpLink
impl UnwindSafe for UdpLink
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