Skip to main content

SecureSerialSender

Struct SecureSerialSender 

Source
pub struct SecureSerialSender<'a, M: RawMutex + 'static, const N_INFLIGHT: usize> { /* private fields */ }
Expand description

Sends logical packets over the link by chunking, queueing wire buffers, and waiting for ACKs.

Implementations§

Source§

impl<'a, M, const N_INFLIGHT: usize> SecureSerialSender<'a, M, N_INFLIGHT>
where M: RawMutex + 'static,

Source

pub fn new( tx_pool: &'static BufferPool<M, Vec<u8, CHUNK_LEN_MAX>, N_INFLIGHT>, tx_queue: Sender<'a, M, BufferGuard<M, Vec<u8, CHUNK_LEN_MAX>>, N_INFLIGHT>, rx_confirm: Receiver<'a, M, Ack, N_INFLIGHT>, retransmit_delay: Duration, allowed_retransmits: usize, ) -> Self

Creates a sender using the shared TX pool and channels from crate::SecureSerialResources.

retransmit_delay spaces chunk transmissions; allowed_retransmits limits how often each chunk may be sent before write_packet fails.

Source

pub async fn write_packet(&mut self, data: &[u8]) -> Result<(), ()>

Encodes data as one packet id, splits it into chunks, and returns when all chunks are ACKed or retries are exhausted (Err(())).

Auto Trait Implementations§

§

impl<'a, M, const N_INFLIGHT: usize> Freeze for SecureSerialSender<'a, M, N_INFLIGHT>

§

impl<'a, M, const N_INFLIGHT: usize> !RefUnwindSafe for SecureSerialSender<'a, M, N_INFLIGHT>

§

impl<'a, M, const N_INFLIGHT: usize> Send for SecureSerialSender<'a, M, N_INFLIGHT>
where M: Sync,

§

impl<'a, M, const N_INFLIGHT: usize> Sync for SecureSerialSender<'a, M, N_INFLIGHT>
where M: Sync,

§

impl<'a, M, const N_INFLIGHT: usize> Unpin for SecureSerialSender<'a, M, N_INFLIGHT>

§

impl<'a, M, const N_INFLIGHT: usize> UnsafeUnpin for SecureSerialSender<'a, M, N_INFLIGHT>

§

impl<'a, M, const N_INFLIGHT: usize> !UnwindSafe for SecureSerialSender<'a, M, N_INFLIGHT>

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