pub struct SrsppRxHandle<'a, E, R: ReceiverBackend, const MAX_STREAMS: usize> { /* private fields */ }Expand description
Handle for receiving data from an SRSPP receiver.
Implementations§
Source§impl<'a, E: Clone, R: ReceiverBackend, const MAX_STREAMS: usize> SrsppRxHandle<'a, E, R, MAX_STREAMS>
impl<'a, E: Clone, R: ReceiverBackend, const MAX_STREAMS: usize> SrsppRxHandle<'a, E, R, MAX_STREAMS>
Sourcepub async fn serve<S, Re, F, Fut, const WIN: usize, const BUF: usize, const MTU: usize>(
&self,
tx: SrsppTxHandle<'a, E, S, Re, WIN, BUF, MTU>,
handler: F,
) -> Result<(), TransportError<E>>where
S: MessageStore,
Re: Reachable,
F: Fn(SrsppStream<'a, E, R, MAX_STREAMS>, SrsppTxHandle<'a, E, S, Re, WIN, BUF, MTU>) -> Fut,
Fut: Future<Output = Result<(), TransportError<E>>>,
pub async fn serve<S, Re, F, Fut, const WIN: usize, const BUF: usize, const MTU: usize>(
&self,
tx: SrsppTxHandle<'a, E, S, Re, WIN, BUF, MTU>,
handler: F,
) -> Result<(), TransportError<E>>where
S: MessageStore,
Re: Reachable,
F: Fn(SrsppStream<'a, E, R, MAX_STREAMS>, SrsppTxHandle<'a, E, S, Re, WIN, BUF, MTU>) -> Fut,
Fut: Future<Output = Result<(), TransportError<E>>>,
Runs concurrent per-connection handlers.
For each new source address that sends data, calls
handler with a SrsppStream scoped to that source
and a copy of tx. Up to MAX_STREAMS handlers run
concurrently.
Returns only on a global error (link failure). Individual handler errors free the slot silently.
Source§impl<'a, E: Clone, R: ReceiverBackend, const MAX_STREAMS: usize> SrsppRxHandle<'a, E, R, MAX_STREAMS>
impl<'a, E: Clone, R: ReceiverBackend, const MAX_STREAMS: usize> SrsppRxHandle<'a, E, R, MAX_STREAMS>
Sourcepub async fn recv(
&mut self,
buf: &mut [u8],
) -> Result<(Address, usize), TransportError<E>>
pub async fn recv( &mut self, buf: &mut [u8], ) -> Result<(Address, usize), TransportError<E>>
Receives the next message, copying it into buf.
Sourcepub fn has_message(&self) -> bool
pub fn has_message(&self) -> bool
Check if there’s a message ready from any sender.
Sourcepub fn stream_count(&self) -> usize
pub fn stream_count(&self) -> usize
Get the number of active streams.
Sourcepub async fn wait_for_message(
&mut self,
) -> Result<DeliveryToken<'_, 'a, E, R, MAX_STREAMS>, TransportError<E>>
pub async fn wait_for_message( &mut self, ) -> Result<DeliveryToken<'_, 'a, E, R, MAX_STREAMS>, TransportError<E>>
Wait for a complete message to become available.
Returns a DeliveryToken that borrows &mut self,
preventing further receives while the token is held.
The driver keeps running — the cell is not borrowed
until DeliveryToken::consume is called.
Sourcepub async fn recv_with<F, Ret>(
&mut self,
f: F,
) -> Result<Ret, TransportError<E>>
pub async fn recv_with<F, Ret>( &mut self, f: F, ) -> Result<Ret, TransportError<E>>
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 (source address, length).