embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

Stream

Struct Stream 

Source
pub struct Stream<'d, D: Driver<'d>> { /* private fields */ }
Expand description

Used for writing audio frames.

Implementations§

Source§

impl<'d, D: Driver<'d>> Stream<'d, D>

Source

pub async fn ready( &mut self, ) -> Result<<D::EndpointIn as IsoEndpointIn>::Slot<'_>, EndpointDisabledError>

Wait until the next packet can be queued, returning a reserved slot.

IsoInSlot::skipped reports how many intervals this writer left empty before this slot.

Source

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

Writes one packet for the next service interval.

Returns how many intervals were skipped before this packet, if any. When the packet contents depend on timing or skipped intervals, call ready first, build the packet, and submit it with IsoInSlot::write. A packet the host does not poll for is dropped rather than sent late.

Source

pub async fn wait_connection(&mut self)

Waits for the USB host to enable this interface: it is listening.

Auto Trait Implementations§

§

impl<'d, D> Forget for Stream<'d, D>

§

impl<'d, D> Freeze for Stream<'d, D>
where <D as Driver<'d>>::EndpointIn: Freeze,

§

impl<'d, D> Move for Stream<'d, D>

§

impl<'d, D> RefUnwindSafe for Stream<'d, D>
where <D as Driver<'d>>::EndpointIn: RefUnwindSafe,

§

impl<'d, D> Send for Stream<'d, D>
where <D as Driver<'d>>::EndpointIn: Send,

§

impl<'d, D> Sync for Stream<'d, D>
where <D as Driver<'d>>::EndpointIn: Sync,

§

impl<'d, D> Unpin for Stream<'d, D>
where <D as Driver<'d>>::EndpointIn: Unpin,

§

impl<'d, D> UnsafeUnpin for Stream<'d, D>
where <D as Driver<'d>>::EndpointIn: UnsafeUnpin,

§

impl<'d, D> UnwindSafe for Stream<'d, D>
where <D as Driver<'d>>::EndpointIn: UnwindSafe,

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 = !

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

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

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.