pub struct UDPMuxConn { /* private fields */ }
Expand description
A UDP mux connection.
Implementations§
Source§impl UDPMuxConn
impl UDPMuxConn
Sourcepub fn new(params: UDPMuxConnParams) -> Self
pub fn new(params: UDPMuxConnParams) -> Self
Creates a new UDPMuxConn
.
Sourcepub async fn write_packet(
&self,
data: &[u8],
addr: SocketAddr,
) -> Result<(), Error>
pub async fn write_packet( &self, data: &[u8], addr: SocketAddr, ) -> Result<(), Error>
Writes data to the given address. Returns an error if the buffer is too short or there’s an encoding error.
Sourcepub fn close_rx(&self) -> Receiver<bool>
pub fn close_rx(&self) -> Receiver<bool>
Gets a copy of the close tokio::sync::watch::Receiver
that fires when this
connection is closed.
Sourcepub fn get_addresses(&self) -> Vec<SocketAddr>
pub fn get_addresses(&self) -> Vec<SocketAddr>
Gets the list of the addresses associated with this connection.
Sourcepub async fn add_address(&self, addr: SocketAddr)
pub async fn add_address(&self, addr: SocketAddr)
Registers a new address for this connection.
Sourcepub fn remove_address(&self, addr: &SocketAddr)
pub fn remove_address(&self, addr: &SocketAddr)
Deregisters an address.
Sourcepub fn contains_address(&self, addr: &SocketAddr) -> bool
pub fn contains_address(&self, addr: &SocketAddr) -> bool
Returns true if the given address is associated with this connection.
Trait Implementations§
Source§impl Clone for UDPMuxConn
impl Clone for UDPMuxConn
Source§fn clone(&self) -> UDPMuxConn
fn clone(&self) -> UDPMuxConn
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Conn for UDPMuxConn
impl Conn for UDPMuxConn
fn connect<'life0, 'async_trait>(
&'life0 self,
_addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
_buf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recv_from<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = Result<(usize, SocketAddr), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
_buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_to<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 [u8],
target: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn local_addr(&self) -> Result<SocketAddr, Error>
fn remote_addr(&self) -> Option<SocketAddr>
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn as_any(&self) -> &(dyn Any + Send + Sync)
Auto Trait Implementations§
impl Freeze for UDPMuxConn
impl !RefUnwindSafe for UDPMuxConn
impl Send for UDPMuxConn
impl Sync for UDPMuxConn
impl Unpin for UDPMuxConn
impl !UnwindSafe for UDPMuxConn
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