Skip to main content

SrsppRxHandle

Struct SrsppRxHandle 

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

Source

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>

Source

pub async fn recv( &mut self, buf: &mut [u8], ) -> Result<(Address, usize), TransportError<E>>

Receives the next message, copying it into buf.

Source

pub fn close(&mut self)

Signal that no more receives are expected. Driver will exit.

Source

pub fn has_message(&self) -> bool

Check if there’s a message ready from any sender.

Source

pub fn stream_count(&self) -> usize

Get the number of active streams.

Source

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.

Source

pub async fn recv_with<F, Ret>( &mut self, f: F, ) -> Result<Ret, TransportError<E>>
where F: FnOnce(&[u8]) -> Ret,

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).

Auto Trait Implementations§

§

impl<'a, E, R, const MAX_STREAMS: usize> Freeze for SrsppRxHandle<'a, E, R, MAX_STREAMS>

§

impl<'a, E, R, const MAX_STREAMS: usize> !RefUnwindSafe for SrsppRxHandle<'a, E, R, MAX_STREAMS>

§

impl<'a, E, R, const MAX_STREAMS: usize> !Send for SrsppRxHandle<'a, E, R, MAX_STREAMS>

§

impl<'a, E, R, const MAX_STREAMS: usize> !Sync for SrsppRxHandle<'a, E, R, MAX_STREAMS>

§

impl<'a, E, R, const MAX_STREAMS: usize> Unpin for SrsppRxHandle<'a, E, R, MAX_STREAMS>

§

impl<'a, E, R, const MAX_STREAMS: usize> UnsafeUnpin for SrsppRxHandle<'a, E, R, MAX_STREAMS>

§

impl<'a, E, R, const MAX_STREAMS: usize> !UnwindSafe for SrsppRxHandle<'a, E, R, MAX_STREAMS>

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.