Struct usb_util::Transfer

source ·
pub struct Transfer {
    urb: Vec<usbdevfs_urb>,
    pub buffer: TransferBuffer,
    callback: Option<Box<dyn Fn(Transfer) + Send + Sync>>,
}
Expand description

Transfer contains the information necessary to submit a USB request and, once it has been submitted and completed, contains the response.

Fields§

§urb: Vec<usbdevfs_urb>§buffer: TransferBuffer§callback: Option<Box<dyn Fn(Transfer) + Send + Sync>>

Implementations§

source§

impl Transfer

source

fn urb(&self) -> &usbdevfs_urb

source

fn urb_mut(&mut self) -> &mut usbdevfs_urb

source

fn new( transfer_type: u8, endpoint: u8, buffer: TransferBuffer, iso_packets: &[usbdevfs_iso_packet_desc] ) -> Result<Transfer>

source

pub fn new_control(buffer: TransferBuffer) -> Result<Transfer>

Create a control transfer.

source

pub fn new_interrupt(endpoint: u8, buffer: TransferBuffer) -> Result<Transfer>

Create an interrupt transfer.

source

pub fn new_bulk( endpoint: u8, buffer: TransferBuffer, stream_id: Option<u16> ) -> Result<Transfer>

Create a bulk transfer.

source

pub fn new_isochronous(endpoint: u8, buffer: TransferBuffer) -> Result<Transfer>

Create an isochronous transfer.

source

pub fn status(&self) -> TransferStatus

Get the status of a completed transfer.

source

pub fn actual_length(&self) -> usize

Get the actual amount of data transferred, which may be less than the original length.

source

pub fn set_callback<C: 'static + Fn(Transfer) + Send + Sync>(&mut self, cb: C)

Set callback function for transfer completion.

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>,

§

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 T
where 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.