pub fn from_full_slice<T>(slice: &[u8]) -> Result<T>where
T: DeserializeOwned,Expand description
Deserialize a value from a byte slice using the Full configuration.
This is a convenience function that calls deserialize_full with the provided byte slice.
It deserializes data that includes struct field identifiers and enum variant identifiers as strings.
ยงExample
use serde::{Serialize, Deserialize};
use postbag::{to_full_vec, from_full_slice};
#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct Person {
name: String,
age: u32,
}
let person = Person {
name: "Alice".to_string(),
age: 30,
};
let bytes = to_full_vec(&person).unwrap();
let deserialized: Person = from_full_slice(&bytes).unwrap();
assert_eq!(person, deserialized);