pub struct SrsppReceiver<L: NetworkWrite + NetworkRead<Error = <L as NetworkWrite>::Error>, R: ReceiverBackend, const MTU: usize> { /* private fields */ }Expand description
Async srspp receiver.
Receives messages reliably over the link, handling reordering and reassembly. Sends ACKs to the remote sender.
Implementations§
Source§impl<L: NetworkWrite + NetworkRead<Error = <L as NetworkWrite>::Error>, R: ReceiverBackend, const MTU: usize> SrsppReceiver<L, R, MTU>
impl<L: NetworkWrite + NetworkRead<Error = <L as NetworkWrite>::Error>, R: ReceiverBackend, const MTU: usize> SrsppReceiver<L, R, MTU>
Sourcepub fn new(
config: ReceiverConfig,
remote_address: Address,
link: L,
ticks_per_sec: u32,
) -> Self
pub fn new( config: ReceiverConfig, remote_address: Address, link: L, ticks_per_sec: u32, ) -> Self
Create a new receiver for a specific remote sender.
Sourcepub async fn recv(&mut self, buf: &mut [u8]) -> Result<usize, SrsppError>
pub async fn recv(&mut self, buf: &mut [u8]) -> Result<usize, SrsppError>
Receive the next complete message.
Blocks until a message is available.
Sourcepub fn try_recv(&mut self, buf: &mut [u8]) -> Option<usize>
pub fn try_recv(&mut self, buf: &mut [u8]) -> Option<usize>
Try to receive a message without blocking.
Returns None if no complete message is available.
Sourcepub async fn wait_for_message(
&mut self,
) -> Result<DeliveryToken<'_, L, R, MTU>, SrsppError>
pub async fn wait_for_message( &mut self, ) -> Result<DeliveryToken<'_, L, R, MTU>, SrsppError>
Wait for a complete message to become available.
Returns a DeliveryToken that borrows &mut self,
preventing further receives while the token is held.
Call DeliveryToken::consume with a synchronous closure
to read the message data without an intermediate copy.
Sourcepub async fn recv_with<F, Ret>(&mut self, f: F) -> Result<Ret, SrsppError>
pub async fn recv_with<F, Ret>(&mut self, f: F) -> Result<Ret, SrsppError>
Wait for a message and process it in-place with a closure.
Equivalent to wait_for_message().await?.consume(f) but
more concise when you don’t need the DeliveryToken
metadata.
Sourcepub async fn poll(&mut self) -> Result<(), SrsppError>
pub async fn poll(&mut self) -> Result<(), SrsppError>
Poll for incoming data and handle timers.