pub fn from_slice<T>(input: &[u8]) -> Result<T, DeserializeError<CsvError>>where
T: Facet<'static>,Expand description
Deserialize a value from CSV bytes into an owned type.
§Errors
Returns an error if the input is not valid UTF-8 or if deserialization fails.
§Example
use facet::Facet;
use facet_csv::from_slice;
#[derive(Facet, Debug, PartialEq)]
struct Person {
name: String,
age: u32,
}
let csv = b"Alice,30";
let person: Person = from_slice(csv).unwrap();
assert_eq!(person.name, "Alice");
assert_eq!(person.age, 30);