pub struct CommandParser<'a, D> { /* private fields */ }
Expand description
use at_commands::parser::CommandParser;
let (x, y, z) = CommandParser::parse(b"+SYSGPIOREAD:654,\"true\",-65154\r\nOK\r\n")
   .expect_identifier(b"+SYSGPIOREAD:")
   .expect_int_parameter()
   .expect_string_parameter()
   .expect_int_parameter()
   .expect_identifier(b"\r\nOK\r\n")
   .finish()
   .unwrap();

assert_eq!(x, 654);
assert_eq!(y, "true");
assert_eq!(z, -65154);

let (w,) = CommandParser::parse(b"+STATUS: READY\r\nOK\r\n")
   .expect_identifier(b"+STATUS: ")
   .expect_raw_string()
   .expect_identifier(b"\r\nOK\r\n")
   .finish()
   .unwrap();

assert_eq!(w, "READY");

Implementations

Start parsing the command

Tries reading an identifier

Finish parsing the command and get the results

Tries reading an int parameter

Tries reading a string parameter

Tries reading a non-parameter, non-quoted string

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.