pub struct HidReaderWriter<'d, D: Driver<'d>, const READ_N: usize, const WRITE_N: usize> { /* private fields */ }
Expand description
USB HID reader/writer.
Implementations§
Source§impl<'d, D: Driver<'d>, const READ_N: usize, const WRITE_N: usize> HidReaderWriter<'d, D, READ_N, WRITE_N>
impl<'d, D: Driver<'d>, const READ_N: usize, const WRITE_N: usize> HidReaderWriter<'d, D, READ_N, WRITE_N>
Sourcepub fn new(
builder: &mut Builder<'d, D>,
state: &'d mut State<'d>,
config: Config<'d>,
) -> Self
pub fn new( builder: &mut Builder<'d, D>, state: &'d mut State<'d>, config: Config<'d>, ) -> Self
Creates a new HidReaderWriter
.
This will allocate one IN and one OUT endpoints. If you only need writing (sending)
HID reports, consider using HidWriter::new
instead, which allocates an IN endpoint only.
Sourcepub fn split(self) -> (HidReader<'d, D, READ_N>, HidWriter<'d, D, WRITE_N>)
pub fn split(self) -> (HidReader<'d, D, READ_N>, HidWriter<'d, D, WRITE_N>)
Splits into separate readers/writers for input and output reports.
Sourcepub async fn write_serialize<IR: AsInputReport>(
&mut self,
r: &IR,
) -> Result<(), EndpointError>
pub async fn write_serialize<IR: AsInputReport>( &mut self, r: &IR, ) -> Result<(), EndpointError>
Writes an input report by serializing the given report structure.
Auto Trait Implementations§
impl<'d, D, const READ_N: usize, const WRITE_N: usize> Freeze for HidReaderWriter<'d, D, READ_N, WRITE_N>
impl<'d, D, const READ_N: usize, const WRITE_N: usize> RefUnwindSafe for HidReaderWriter<'d, D, READ_N, WRITE_N>
impl<'d, D, const READ_N: usize, const WRITE_N: usize> Send for HidReaderWriter<'d, D, READ_N, WRITE_N>
impl<'d, D, const READ_N: usize, const WRITE_N: usize> Sync for HidReaderWriter<'d, D, READ_N, WRITE_N>
impl<'d, D, const READ_N: usize, const WRITE_N: usize> Unpin for HidReaderWriter<'d, D, READ_N, WRITE_N>
impl<'d, D, const READ_N: usize, const WRITE_N: usize> UnwindSafe for HidReaderWriter<'d, D, READ_N, WRITE_N>
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