pub trait MaybeFuture: IntoFuture + Sized {
// Provided method
fn wait(self) -> Self::Output { ... }
}Expand description
Provided Methods§
Sourcefn wait(self) -> Self::Output
fn wait(self) -> Self::Output
Run the action to completion, blocking the current thread.
Examples found in repository?
More examples
examples/read_input.rs (line 20)
12fn main() -> hidra::HidResult<()> {
13 let mut args = env::args().skip(1);
14 let vid = u16::from_str_radix(&args.next().expect("usage: read_input <vid> <pid>"), 16)
15 .expect("vid must be hex");
16 let pid = u16::from_str_radix(&args.next().expect("usage: read_input <vid> <pid>"), 16)
17 .expect("pid must be hex");
18
19 let api = hidra::Hidra::new()?;
20 let device = api.open(vid, pid).wait()?;
21
22 println!("product: {:?}", device.get_product_string().wait()?);
23 let descriptor = device.parsed_report_descriptor().wait()?;
24 println!(
25 "report descriptor: {} top-level collection(s), max input report {} bytes, numbered ids: {}",
26 descriptor.collections.len(),
27 descriptor.max_report_size(hidra::descriptor::ReportKind::Input),
28 descriptor.uses_report_ids(),
29 );
30
31 println!("reading input reports (ctrl-c to quit)...");
32 let mut buf = [0u8; 256];
33 loop {
34 // Blocks until a report arrives; never returns 0.
35 let len = device.read(&mut buf).wait()?;
36 println!("{:02x?}", &buf[..len]);
37 }
38}Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<T: IntoFuture> MaybeFuture for T
Available on non-WebAssembly only.