Struct usb_device::class::ControlIn

source ·
pub struct ControlIn<'a, 'p, 'r, B: UsbBus> { /* private fields */ }
Expand description

Handle for a control IN transfer. When implementing a class, use the methods of this object to response to the transfer with either data or an error (STALL condition). To ignore the request and pass it on to the next class, simply don’t call any method.

Implementations§

source§

impl<'a, 'p, 'r, B: UsbBus> ControlIn<'a, 'p, 'r, B>

source

pub fn request(&self) -> &Request

Gets the request from the SETUP packet.

source

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

Accepts the transfer with the supplied buffer.

source

pub fn accept_with_static(self, data: &'static [u8]) -> Result<()>

Accepts the transfer with the supplied static buffer. This method is useful when you have a large static descriptor to send as one packet.

source

pub fn accept(self, f: impl FnOnce(&mut [u8]) -> Result<usize>) -> Result<()>

Accepts the transfer with a callback that can write to the internal buffer of the control pipe. Can be used to avoid an extra copy.

source

pub fn reject(self) -> Result<()>

Rejects the transfer by stalling the pipe.

Auto Trait Implementations§

§

impl<'a, 'p, 'r, B> RefUnwindSafe for ControlIn<'a, 'p, 'r, B>

§

impl<'a, 'p, 'r, B> Send for ControlIn<'a, 'p, 'r, B>

§

impl<'a, 'p, 'r, B> Sync for ControlIn<'a, 'p, 'r, B>

§

impl<'a, 'p, 'r, B> Unpin for ControlIn<'a, 'p, 'r, B>

§

impl<'a, 'p, 'r, B> !UnwindSafe for ControlIn<'a, 'p, 'r, B>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.