Skip to main content

SrsppSender

Struct SrsppSender 

Source
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>

Source

pub fn new( config: SenderConfig, link: L, rto_policy: P, ticks_per_sec: u32, ) -> Self

Create a new sender.

Source

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.

Source

pub async fn flush(&mut self) -> Result<(), SrsppError>

Wait for all sent data to be acknowledged.

Source

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.

Source

pub fn is_idle(&self) -> bool

Check if all data has been acknowledged.

Source

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>
where L: Freeze, P: Freeze,

§

impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> RefUnwindSafe for SrsppSender<L, P, WIN, BUF, MTU>

§

impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> Send for SrsppSender<L, P, WIN, BUF, MTU>
where L: Send, P: Send,

§

impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> Sync for SrsppSender<L, P, WIN, BUF, MTU>
where L: Sync, P: Sync,

§

impl<L, P, const WIN: usize, const BUF: usize, const MTU: usize> Unpin for SrsppSender<L, P, WIN, BUF, MTU>
where L: Unpin, P: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.