fn from_str(s: &str) -> Result<DateTimeTuple, Self::Err> {
        lazy_static! {
            static ref VALID_FORMAT: Regex =
                Regex::new(r"^\d{4}-\d{2}-\d{2}@\d{2}:\d{2}:\d{2}$").unwrap();
            static ref LEGACY_FORMAT: Regex = Regex::new(r"^\d{8}@\d{2}:\d{2}:\d{2}$").unwrap();
        }

        if VALID_FORMAT.is_match(s) || LEGACY_FORMAT.is_match(s) {
            let mut parts = s.split('@');
            let date_part = match DateTuple::from_str(parts.next().unwrap()) {
                Ok(d) => d,
                Err(e) => return Err(format!("Invalid date passed to from_str: {}", e)),
            };
            let time_part = TimeTuple::from_str(parts.next().unwrap()).unwrap();
            Ok(DateTimeTuple::new(date_part, time_part))
        } else {
            Err(format!("Invalid str formatting of DateTimeTuple: {}\nExpects a string formatted like 2018-11-02@08:30:00", s))
        }
    }
/// Expects a string formatted like one obtained by calling `DateTimeTuple.to_string()`
Expects a string formatted like one obtained by calling `DateTimeTuple.to_string()`
Expects a string formatted like one obtained by calling ` DateTimeTuple . to_string () `
fn from_str(s: &str) -> Result<DateTimeTuple, Self::Err> {
        lazy_static! {
            static ref VALID_FORMAT: Regex =
                Regex::new(r"^\d{4}-\d{2}-\d{2}@\d{2}:\d{2}:\d{2}$").unwrap();
            static ref LEGACY_FORMAT: Regex = Regex::new(r"^\d{8}@\d{2}:\d{2}:\d{2}$").unwrap();
        }
        if VALID_FORMAT.is_match(s) || LEGACY_FORMAT.is_match(s) {
            let mut parts = s.split('@');
            let date_part = match DateTuple::from_str(parts.next().unwrap()) {
                Ok(d) => d,
                Err(e) => return Err(format!("Invalid date passed to from_str: {}", e)),
            };
            let time_part = TimeTuple::from_str(parts.next().unwrap()).unwrap();
            Ok(DateTimeTuple::new(date_part, time_part))
        } else {
            Err(format!("Invalid str formatting of DateTimeTuple: {}\nExpects a string formatted like 2018-11-02@08:30:00", s))
        }
    }
fn from_str ( s : & str ) -> Result < DateTimeTuple , Self :: Err > { lazy_static ! { static ref VALID_FORMAT Regex Regex new ( r"^\d{4}-\d{2}-\d{2}@\d{2}:\d{2}:\d{2}$" ) unwrap ( ) static ref LEGACY_FORMAT Regex Regex new ( r"^\d{8}@\d{2}:\d{2}:\d{2}$" ) unwrap ( ) } if VALID_FORMAT . is_match ( s ) || LEGACY_FORMAT . is_match ( s ) { let mut parts = s . split ( '@' ) ; let date_part = match DateTuple :: from_str ( parts . next ( ) . unwrap ( ) ) { Ok ( d ) => d , Err ( e ) => return Err ( format ! ( " " e ) ) , } ; let time_part = TimeTuple :: from_str ( parts . next ( ) . unwrap ( ) ) . unwrap ( ) ; Ok ( DateTimeTuple :: new ( date_part , time_part ) ) } else { Err ( format ! ( " \n " s ) ) } }
Expects a string formatted like one obtained by calling `DateTimeTuple.to_string()`
Expects a string formatted like one obtained by calling ` DateTimeTuple . to_string () `
s
&str
s
&str