pub struct PacketSender { /* private fields */ }Expand description
Sender for transmitting packets
Implementations§
Source§impl PacketSender
impl PacketSender
Sourcepub async fn send_to(&self, packet: &[u8], target: SocketAddr) -> Result<usize>
pub async fn send_to(&self, packet: &[u8], target: SocketAddr) -> Result<usize>
Send a packet to the specified address
Sourcepub async fn send(&self, packet: &[u8]) -> Result<usize>
pub async fn send(&self, packet: &[u8]) -> Result<usize>
Send a packet to the connected address
Sourcepub fn try_send_to(&self, packet: &[u8], target: SocketAddr) -> Result<usize>
pub fn try_send_to(&self, packet: &[u8], target: SocketAddr) -> Result<usize>
Try to send without blocking
Sourcepub fn send_batch(&self, packets: &[Bytes], target: SocketAddr) -> Result<usize>
pub fn send_batch(&self, packets: &[Bytes], target: SocketAddr) -> Result<usize>
Send multiple packets in a single syscall (Linux only).
Falls back to sequential send_to on other platforms.
Uses BatchedTransport::new_send_only so we don’t allocate the
64 × 8KB receive-side buffer set on a pure-send path. This is a
fresh BatchedTransport per call because the struct’s iovec
slots point into the caller’s packets slice — sharing one
across concurrent calls would require a lock on the hot path.
Trait Implementations§
Source§impl Clone for PacketSender
impl Clone for PacketSender
Source§fn clone(&self) -> PacketSender
fn clone(&self) -> PacketSender
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PacketSender
impl RefUnwindSafe for PacketSender
impl Send for PacketSender
impl Sync for PacketSender
impl Unpin for PacketSender
impl UnsafeUnpin for PacketSender
impl UnwindSafe for PacketSender
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