embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

DataOutReader

Struct DataOutReader 

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

Streaming reader for an MTP Data-OUT container.

Implementations§

Source§

impl<'a, 'd, D: Driver<'d>> DataOutReader<'a, 'd, D>

Source

pub const fn header(&self) -> ContainerHeader

Returns the decoded container header.

Source

pub const fn code(&self) -> u16

Returns the operation code from the Data container header.

Source

pub const fn transaction_id(&self) -> u32

Returns the transaction ID from the Data container header.

Source

pub const fn total_payload_len(&self) -> Option<u32>

Returns the declared payload length in bytes, or None for streaming containers.

Source

pub const fn bytes_read(&self) -> u64

Returns the number of payload bytes consumed via read so far.

Source

pub const fn remaining(&self) -> Option<u64>

Returns the number of unread payload bytes remaining, if declared by the header.

Source

pub const fn is_eof(&self) -> bool

Returns true if all buffered and wire bytes of this Data container have been consumed.

Source

pub async fn read(&mut self, out: &mut [u8]) -> Result<usize, MtpError>

Reads the next chunk of payload data into out.

Returns Ok(0) once the entire Data container has been read.

Source

pub async fn drain(self) -> Result<(), MtpError>

Discards any remaining payload bytes in this Data container.

Auto Trait Implementations§

§

impl<'a, 'd, D> !UnwindSafe for DataOutReader<'a, 'd, D>

§

impl<'a, 'd, D> Forget for DataOutReader<'a, 'd, D>

§

impl<'a, 'd, D> Freeze for DataOutReader<'a, 'd, D>
where &'a mut <D as Driver<'d>>::EndpointOut: Freeze,

§

impl<'a, 'd, D> Move for DataOutReader<'a, 'd, D>

§

impl<'a, 'd, D> RefUnwindSafe for DataOutReader<'a, 'd, D>
where &'a mut <D as Driver<'d>>::EndpointOut: RefUnwindSafe,

§

impl<'a, 'd, D> Send for DataOutReader<'a, 'd, D>
where &'a mut <D as Driver<'d>>::EndpointOut: Send,

§

impl<'a, 'd, D> Sync for DataOutReader<'a, 'd, D>
where &'a mut <D as Driver<'d>>::EndpointOut: Sync,

§

impl<'a, 'd, D> Unpin for DataOutReader<'a, 'd, D>
where &'a mut <D as Driver<'d>>::EndpointOut: Unpin,

§

impl<'a, 'd, D> UnsafeUnpin for DataOutReader<'a, 'd, D>
where &'a mut <D as Driver<'d>>::EndpointOut: UnsafeUnpin,

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.