pub struct HidWriter<'d, D: Driver<'d>, const N: usize> { /* private fields */ }
Expand description
USB HID writer.
You can obtain a HidWriter
using HidReaderWriter::split
.
Implementations§
Source§impl<'d, D: Driver<'d>, const N: usize> HidWriter<'d, D, N>
impl<'d, D: Driver<'d>, const N: usize> HidWriter<'d, D, 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 HidWriter.
This will allocate one IN endpoint only, so the host won’t be able to send
reports to us. If you need that, consider using HidReaderWriter::new
instead.
poll_ms configures how frequently the host should poll for reading/writing HID reports. A lower value means better throughput & latency, at the expense of CPU on the device & bandwidth on the bus. A value of 10 is reasonable for high performance uses, and a value of 255 is good for best-effort usecases.
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 N: usize> Freeze for HidWriter<'d, D, N>
impl<'d, D, const N: usize> RefUnwindSafe for HidWriter<'d, D, N>
impl<'d, D, const N: usize> Send for HidWriter<'d, D, N>
impl<'d, D, const N: usize> Sync for HidWriter<'d, D, N>
impl<'d, D, const N: usize> Unpin for HidWriter<'d, D, N>
impl<'d, D, const N: usize> UnwindSafe for HidWriter<'d, D, 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