/// Parses a string and extracts a Gedcomx date.
///
///
/// ## Example
///
/// ```rust
/// use gedcomx_date::{parse, GedcomxDate};
/// let date = parse("+1988-03-29T03:19").unwrap();
/// match date {
///     GedcomxDate::Simple(simple_date) => {
///         let date = simple_date.date;
///         println!("{}", date.year); // 1988
///         println!("{}", date.month.unwrap()); // 3
///         println!("{}", date.day.unwrap()); // 29
///         let time = simple_date.time.unwrap();
///         println!("{}", time.hours); // 3
///         println!("{}", time.minutes.unwrap()); // 19
///     },
///    _ => {}
/// }
/// ```
Parses a string and extracts a Gedcomx date.
Parses a string and extracts a Gedcomx date .
pub fn parse(string: &str) -> Result<GedcomxDate, String> {
    match parsers::parse(string.as_bytes()) {
        Done(_, parsed) => Ok(parsed),
        Error(_) => Err(format!("Parsing error")),
        Incomplete(_) => Err(format!("Parsing error")),
    }
}
pub fn parse ( string : & str ) -> Result < GedcomxDate , String > { match parsers :: parse ( string . as_bytes ( ) ) { Done ( _ , parsed ) => Ok ( parsed ) , Error ( _ ) => Err ( format ! ( " " ) ) , Incomplete ( _ ) => Err ( format ! ( " " ) ) , } }
Parses a string and extracts a Gedcomx date.
Parses a string and extracts a Gedcomx date .
string
&str
example
None