embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

ControlShared

Struct ControlShared 

Source
pub struct ControlShared { /* private fields */ }
Expand description

Shared state between the USB control handler and MtpClass.

Implementations§

Source§

impl ControlShared

Source

pub const fn new() -> Self

Creates a new ControlShared with status resp::OK.

Source

pub fn set_device_status(&self, status: u16)

Sets the status code returned to the host by REQ_GET_DEVICE_STATUS (0x67).

Source

pub fn device_status(&self) -> u16

Returns the current device status code.

Source

pub fn take_cancel(&self) -> Option<u32>

Returns and clears the cancelled transaction ID if the host sent REQ_CANCEL (0x64).

Source

pub fn take_reset(&self) -> bool

Returns and clears whether the host sent REQ_RESET (0x66).

Trait Implementations§

Source§

impl Default for ControlShared

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.