pub struct SrsppSender<L: NetworkWrite + NetworkRead<Error = <L as NetworkWrite>::Error>, P: RtoPolicy, const WIN: usize, const BUF: usize, const MTU: usize> { /* private fields */ }Expand description
Async srspp sender.
Sends messages reliably over the link, handling segmentation and retransmission. Receives ACKs from the remote receiver.
Implementations§
Source§impl<L: NetworkWrite + NetworkRead<Error = <L as NetworkWrite>::Error>, P: RtoPolicy, const WIN: usize, const BUF: usize, const MTU: usize> SrsppSender<L, P, WIN, BUF, MTU>
impl<L: NetworkWrite + NetworkRead<Error = <L as NetworkWrite>::Error>, P: RtoPolicy, const WIN: usize, const BUF: usize, const MTU: usize> SrsppSender<L, P, WIN, BUF, MTU>
Sourcepub fn new(
config: SenderConfig,
link: L,
rto_policy: P,
ticks_per_sec: u32,
) -> Self
pub fn new( config: SenderConfig, link: L, rto_policy: P, ticks_per_sec: u32, ) -> Self
Create a new sender.
Sourcepub async fn send(
&mut self,
target: Address,
data: &(impl IntoBytes + Immutable + ?Sized),
) -> Result<(), SrsppError>
pub async fn send( &mut self, target: Address, data: &(impl IntoBytes + Immutable + ?Sized), ) -> Result<(), SrsppError>
Send a message.
The message is segmented if necessary and queued for transmission. This returns when all packets have been transmitted (but not necessarily ACKed).
For guaranteed delivery, call flush() after sending.
Sourcepub async fn flush(&mut self) -> Result<(), SrsppError>
pub async fn flush(&mut self) -> Result<(), SrsppError>
Wait for all sent data to be acknowledged.
Sourcepub async fn poll(&mut self) -> Result<(), SrsppError>
pub async fn poll(&mut self) -> Result<(), SrsppError>
Poll for incoming ACKs and handle timeouts.
Call this periodically if you want to process ACKs without blocking on flush.
Sourcepub fn available_bytes(&self) -> usize
pub fn available_bytes(&self) -> usize
Available buffer space in bytes.
Auto Trait Implementations§
impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> Freeze for SrsppSender<L, P, WIN, BUF, MTU>
impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> RefUnwindSafe for SrsppSender<L, P, WIN, BUF, MTU>where
L: RefUnwindSafe,
P: RefUnwindSafe,
impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> Send for SrsppSender<L, P, WIN, BUF, MTU>
impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> Sync for SrsppSender<L, P, WIN, BUF, MTU>
impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> Unpin for SrsppSender<L, P, WIN, BUF, MTU>
impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> UnsafeUnpin for SrsppSender<L, P, WIN, BUF, MTU>where
L: UnsafeUnpin,
P: UnsafeUnpin,
impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> UnwindSafe for SrsppSender<L, P, WIN, BUF, MTU>where
L: UnwindSafe,
P: UnwindSafe,
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