serde_x12 0.7.1

A Serde for ASC X12 EDI documents.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::Error;

pub fn from_str<'a, T>(s: &'a str) -> Result<T, Error>
where
    T: Default + x12_types::util::Parser<&'a str, T, nom::error::Error<&'a str>>,
{
    let result = T::parse(s);
    match result {
        Ok(val) => Ok(val.1),
        Err(err) => Err(Error::Message(format!("failed: {:?}", err))),
    }
}