pub struct FakeTransport { /* private fields */ }Available on crate feature
fake-transport only.Expand description
Thread-safe fake USB device for tests (crate::Transport implementor).
Implementations§
Source§impl FakeTransport
impl FakeTransport
Sourcepub fn new() -> Self
pub fn new() -> Self
Same as Self::cdc_single_iface.
Sourcepub fn cdc_single_iface() -> Self
pub fn cdc_single_iface() -> Self
Single CDC ACM interface with bulk IN/OUT endpoints (castrated single-iface layout).
Sourcepub fn ftdi_ft232r() -> Self
pub fn ftdi_ft232r() -> Self
FT232R-shaped single-interface layout (0403:6001).
pub fn ftdi_ft2232() -> Self
pub fn cp2102() -> Self
pub fn cp2105() -> Self
pub fn ch340_dual_iface() -> Self
pub fn pl2303_hx() -> Self
pub fn pl2303_hxn() -> Self
pub fn pl2303_type01() -> Self
pub fn pl2303_ta() -> Self
pub fn cdc_iad() -> Self
pub fn cdc_multi() -> Self
pub fn gsm_modem() -> Self
pub fn chrome_ccd_3port() -> Self
pub fn recorded_bulk_out(&self) -> Vec<RecordedBulkOut>
pub fn push_rx(&self, data: &[u8])
pub fn push_interrupt_in(&self, data: &[u8])
Sourcepub fn recorded_controls(&self) -> Vec<RecordedControl>
pub fn recorded_controls(&self) -> Vec<RecordedControl>
Snapshot recorded control transfers.
pub fn clear_recorded(&self)
pub fn claimed_interfaces(&self) -> Vec<u8> ⓘ
Sourcepub fn script_control_in_response(&self, data: Vec<u8>)
pub fn script_control_in_response(&self, data: Vec<u8>)
Queue the next control_in response payload (FIFO).
pub fn inject_bulk_read_error(&self, msg: impl Into<String>)
pub fn set_interfaces(&self, interfaces: Vec<InterfaceInfo>)
pub fn configure_endpoints(&self, layout: &[(u8, Vec<EndpointInfo>)])
pub fn set_raw_descriptors(&self, raw: Vec<u8>)
pub fn set_vendor_product(&self, vendor_id: u16, product_id: u16)
pub fn patch_device_descriptor(&self, patch: impl FnMut(&mut [u8; 18]))
Trait Implementations§
Source§impl Clone for FakeTransport
impl Clone for FakeTransport
Source§fn clone(&self) -> FakeTransport
fn clone(&self) -> FakeTransport
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FakeTransport
impl Debug for FakeTransport
Source§impl Default for FakeTransport
impl Default for FakeTransport
Source§impl Transport for FakeTransport
impl Transport for FakeTransport
fn raw_device_descriptor(&self) -> [u8; 18]
fn raw_descriptors(&self) -> Vec<u8> ⓘ
fn device_class(&self) -> u8
fn interfaces(&self) -> Vec<InterfaceInfo>
fn endpoints(&self, interface: u8) -> Vec<EndpointInfo>
fn claim_interface(&self, interface: u8) -> Result<()>
fn release_interface(&self, interface: u8) -> Result<()>
fn control_out(&self, req: &ControlRequest) -> Result<usize>
fn control_in(&self, req: &ControlRequest) -> Result<Vec<u8>>
fn open_bulk_in( &self, endpoint: u8, _max_packet_size: u16, ) -> Result<Box<dyn BulkIn>>
fn open_bulk_out( &self, endpoint: u8, _max_packet_size: u16, ) -> Result<Box<dyn BulkOut>>
fn open_interrupt_in( &self, endpoint: u8, _max_packet_size: u16, ) -> Result<Box<dyn BulkIn>>
Auto Trait Implementations§
impl Freeze for FakeTransport
impl RefUnwindSafe for FakeTransport
impl Send for FakeTransport
impl Sync for FakeTransport
impl Unpin for FakeTransport
impl UnsafeUnpin for FakeTransport
impl UnwindSafe for FakeTransport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more