Function from_str_sep

Source
pub fn from_str_sep<T: DeserializeOwned>(s: &str, sep: char) -> Result<T, Error>
Expand description

Deserializes a string with a custom separator.

§Arguments

  • s - The string slice to deserialize.
  • sep - The separator character.

§Example

#[derive(Debug, PartialEq, serde::Deserialize)]
struct Bar(Vec<u32>);

assert_eq!(csv_line::from_str_sep::<Bar>("31 42 28 97 0", ' ').unwrap(), Bar(vec![31,42,28,97,0]));