Skip to main content

RxReception

Struct RxReception 

Source
pub struct RxReception<'c> { /* private fields */ }
Available on crate feature unstable only.
Expand description

A reception in progress, see RxChannel::start_receive.

Dropping it stops the reception.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Implementations§

Source§

impl RxReception<'_>

Source

pub fn poll(&mut self, buf: &mut [PulseCode]) -> Result<RxProgress, RxError>

Copies the codes received since the previous call into buf.

Codes that do not fit into buf stay in the channel RAM, and the next call copies them. Returns RxProgress::Done once the reception has ended and every code has been copied.

The hardware makes a PulseCode available only when both of its pulses are complete. Thus, the last pulse can be missing until the next edge on the input. The last code of a frame contains the end marker.

While the reception runs, call this often enough that fewer codes arrive between two calls than the channel RAM holds (CHANNEL_RAM_SIZE codes per block). Otherwise the hardware overwrites codes before they are copied, and this function cannot detect it.

§Errors
  • RxError::BufferTooSmall if buf is empty while codes are waiting. The codes stay in the channel RAM, and a call with space in buf copies them.
  • RxError::Overrun if the reception failed. Every further call returns it.
§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn stop(self)

Stops the reception, the same as dropping it.

The reception stops immediately, before the idle threshold. Codes that were not copied by Self::poll are lost.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Trait Implementations§

Source§

impl<'c> Debug for RxReception<'c>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'c> !UnwindSafe for RxReception<'c>

§

impl<'c> Forget for RxReception<'c>

§

impl<'c> Freeze for RxReception<'c>
where PhantomData<Rx>: Freeze, PhantomData<&'c mut ()>: Freeze,

§

impl<'c> Move for RxReception<'c>

§

impl<'c> RefUnwindSafe for RxReception<'c>

§

impl<'c> Send for RxReception<'c>

§

impl<'c> Sync for RxReception<'c>

§

impl<'c> Unpin for RxReception<'c>
where &'c mut (): Unpin,

§

impl<'c> UnsafeUnpin for RxReception<'c>
where PhantomData<Rx>: UnsafeUnpin, PhantomData<&'c mut ()>: UnsafeUnpin,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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
§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.