pub struct Processor { /* private fields */ }Implementations§
Source§impl Processor
impl Processor
pub fn new(producer: Producer<'static, BUFFER_SIZE>) -> Processor
Sourcepub fn process_slice(&mut self, slice: &[u8]) -> Result<(), Error>
pub fn process_slice(&mut self, slice: &[u8]) -> Result<(), Error>
Examples found in repository?
examples/check.rs (line 21)
7fn main() -> std::io::Result<()> {
8 let test_data: Vec<u8> = vec![
9 0x34, 0x45, 0x32, 0xAA, 0xAA, 0xDE, 0x01, 0x00, 0x92, 0xFF, 0x25, 0x08, 0x8D, 0xFE, 0xEC,
10 0xFF, 0xD1, 0x03, 0x00, 0x00, 0x00, 0xE7, 0xFF, 0xBB, 0xAA,
11 ];
12
13 let (mut proc, mut parser) = match bno08x_rvc::create(BB.borrow()) {
14 Ok((proc, pars)) => (proc, pars),
15 Err(e) => {
16 println!("Can't create bno08x-rvc : {:?}", e);
17 return Ok(());
18 }
19 };
20
21 proc.process_slice(test_data.as_slice()).unwrap();
22
23 println!("Get last raw frame: {:?}", parser.get_last_raw_frame());
24
25 match parser.worker(|frame| {
26 println!("Worker Frame: {:?}", frame);
27 }) {
28 Ok(_) => {}
29 Err(e) => {
30 println!("Worker error: {:?}", e)
31 }
32 }
33
34 println!("Get last raw frame: {:?}", parser.get_last_raw_frame());
35
36 println!(
37 "Get last pretty frame: {:?}",
38 parser.get_last_raw_frame().unwrap().as_pretty_frame()
39 );
40
41 parser
42 .get_last_raw_frame()
43 .unwrap()
44 .as_pretty_closure(|p_f| {
45 println!("Pretty frame in closure: {:?}", p_f);
46 });
47
48 Ok(())
49}Auto Trait Implementations§
impl Freeze for Processor
impl !RefUnwindSafe for Processor
impl Send for Processor
impl !Sync for Processor
impl Unpin for Processor
impl UnsafeUnpin for Processor
impl !UnwindSafe for Processor
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