pub fn from_str<T>(input: &str) -> Result<T, DeserializeError<CsvError>>where
T: Facet<'static>,Expand description
Deserialize a value from a CSV string into an owned type.
Note: This parses a single CSV row (not including the header). For multiple rows, iterate over lines and call this for each.
ยงExample
use facet::Facet;
use facet_csv::from_str;
#[derive(Facet, Debug, PartialEq)]
struct Person {
name: String,
age: u32,
}
let csv = "Alice,30";
let person: Person = from_str(csv).unwrap();
assert_eq!(person.name, "Alice");
assert_eq!(person.age, 30);