Expand description
Wrapper type to allow deserializing a number of chars as a char vector
Example:
use heapless::String;
use serde_at::{from_str, Bytes, CharVec, SerializeOptions};
use serde_derive::Deserialize;
#[derive(Debug, Deserialize, PartialEq)]
struct CommandStruct {
id: u8,
vec: CharVec<7>,
value: i32,
}
let incoming: CommandStruct = from_str("+CCID: 4,IMP_MSG,-12").expect("Failed to parse CCID");
let expected = CommandStruct {
id: 4,
vec: CharVec(heapless::Vec::from_slice(&['I', 'M', 'P', '_', 'M', 'S', 'G']).expect("CharVec overflow")),
value: -12,
};
assert_eq!(incoming, expected);
Instantiate a new CharVec
of capacity N
Convert from CharVec
to String
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Serialize this value into the given Serde serializer. Read more
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.