Struct libp2p_rs::runtime::net::UdpSocket [−][src]
pub struct UdpSocket(_);
Implementations
impl UdpSocket
[src]
pub async fn bind<A>(addrs: A) -> Result<UdpSocket, Error> where
A: ToSocketAddrs,
[src]
A: ToSocketAddrs,
Creates a UDP socket from the given address.
pub fn peer_addr(&self) -> Result<SocketAddr, Error>
[src]
Returns the peer address that this listener is connected to.
pub fn local_addr(&self) -> Result<SocketAddr, Error>
[src]
Returns the local address that this listener is bound to.
pub async fn send_to<A>(
&'_ self,
buf: &'_ [u8],
addrs: A
) -> Result<usize, Error> where
A: ToSocketAddrs,
[src]
&'_ self,
buf: &'_ [u8],
addrs: A
) -> Result<usize, Error> where
A: ToSocketAddrs,
Sends data on the socket to the given address.
pub async fn recv_from(
&'_ self,
buf: &'_ mut [u8]
) -> Result<(usize, SocketAddr), Error>
[src]
&'_ self,
buf: &'_ mut [u8]
) -> Result<(usize, SocketAddr), Error>
Receives data from the socket.
pub async fn peek_from(
&'_ self,
buf: &'_ mut [u8]
) -> Result<(usize, SocketAddr), Error>
[src]
&'_ self,
buf: &'_ mut [u8]
) -> Result<(usize, SocketAddr), Error>
Receives data from socket without removing it from the queue.
pub async fn connect<A>(&'_ self, addrs: A) -> Result<(), Error> where
A: ToSocketAddrs,
[src]
A: ToSocketAddrs,
Connects the UDP socket to a remote address.
pub async fn send(&'_ self, buf: &'_ [u8]) -> Result<usize, Error>
[src]
Sends data on the socket to the remote address to which it is connected.
pub async fn recv(&'_ self, buf: &'_ mut [u8]) -> Result<usize, Error>
[src]
Receives data from the socket.
pub async fn peek(&'_ self, buf: &'_ mut [u8]) -> Result<usize, Error>
[src]
Receives data from the socket without removing it from the queue.
pub fn broadcast(&self) -> Result<bool, Error>
[src]
Gets the value of the SO_BROADCAST
option for this socket.
pub fn set_broadcast(&self, on: bool) -> Result<(), Error>
[src]
Sets the value of the SO_BROADCAST
option for this socket.
pub fn multicast_loop_v4(&self) -> Result<bool, Error>
[src]
Gets the value of the IP_MULTICAST_LOOP
option for this socket.
pub fn set_multicast_loop_v4(&self, on: bool) -> Result<(), Error>
[src]
Sets the value of the IP_MULTICAST_LOOP
option for this socket.
pub fn multicast_ttl_v4(&self) -> Result<u32, Error>
[src]
Gets the value of the IP_MULTICAST_TTL
option for this socket.
pub fn set_multicast_ttl_v4(&self, ttl: u32) -> Result<(), Error>
[src]
Sets the value of the IP_MULTICAST_TTL
option for this socket.
pub fn multicast_loop_v6(&self) -> Result<bool, Error>
[src]
Gets the value of the IPV6_MULTICAST_LOOP
option for this socket.
pub fn set_multicast_loop_v6(&self, on: bool) -> Result<(), Error>
[src]
Sets the value of the IPV6_MULTICAST_LOOP
option for this socket.
pub fn ttl(&self) -> Result<u32, Error>
[src]
Gets the value of the IP_TTL
option for this socket.
pub fn set_ttl(&self, ttl: u32) -> Result<(), Error>
[src]
Sets the value for the IP_TTL
option on this socket.
pub fn join_multicast_v4(
&self,
multiaddr: Ipv4Addr,
interface: Ipv4Addr
) -> Result<(), Error>
[src]
&self,
multiaddr: Ipv4Addr,
interface: Ipv4Addr
) -> Result<(), Error>
Executes an operation of the IP_ADD_MEMBERSHIP
type.
pub fn join_multicast_v6(
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<(), Error>
[src]
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<(), Error>
Executes an operation of the IPV6_ADD_MEMBERSHIP
type.
pub fn leave_multicast_v4(
&self,
multiaddr: Ipv4Addr,
interface: Ipv4Addr
) -> Result<(), Error>
[src]
&self,
multiaddr: Ipv4Addr,
interface: Ipv4Addr
) -> Result<(), Error>
Executes an operation of the IP_DROP_MEMBERSHIP
type.
pub fn leave_multicast_v6(
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<(), Error>
[src]
&self,
multiaddr: &Ipv6Addr,
interface: u32
) -> Result<(), Error>
Executes an operation of the IPV6_DROP_MEMBERSHIP
type.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for UdpSocket
impl Send for UdpSocket
impl Sync for UdpSocket
impl Unpin for UdpSocket
impl UnwindSafe for UdpSocket
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,
pub 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> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
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.
pub 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.
pub 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>,