Skip to main content

Processor

Struct Processor 

Source
pub struct Processor { /* private fields */ }

Implementations§

Source§

impl Processor

Source

pub fn new(producer: Producer<'static, BUFFER_SIZE>) -> Processor

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.