pub(crate) fn parse(value: &str) -> Result<Instant, DateParseError> {
        let mut parts = value.splitn(2, '.');
        let (mut whole, mut decimal) = (0i64, 0u32);
        if let Some(whole_str) = parts.next() {
            whole = <i64>::from_str(whole_str).map_err(|_| DateParseError::IntParseError)?;
        }
        if let Some(decimal_str) = parts.next() {
            if decimal_str.starts_with('+') || decimal_str.starts_with('-') {
                return Err(DateParseError::Invalid("invalid epoch-seconds timestamp"));
            }
            if decimal_str.len() > 9 {
                return Err(DateParseError::Invalid("decimal is longer than 9 digits"));
            }
            let missing_places = 9 - decimal_str.len() as isize;
            decimal = <u32>::from_str(decimal_str).map_err(|_| DateParseError::IntParseError)?;
            for _ in 0..missing_places {
                decimal *= 10;
            }
        }
        Ok(Instant::from_secs_and_nanos(whole, decimal))
    }
/// Parses the Smithy epoch seconds date-time format into an `Instant`.
Parses the Smithy epoch seconds date-time format into an `Instant`.
Parses the Smithy epoch seconds date - time format into an ` Instant ` .
pub(crate) fn parse(value: &str) -> Result<Instant, DateParseError> {
        let mut parts = value.splitn(2, '.');
        let (mut whole, mut decimal) = (0i64, 0u32);
        if let Some(whole_str) = parts.next() {
            whole = <i64>::from_str(whole_str).map_err(|_| DateParseError::IntParseError)?;
        }
        if let Some(decimal_str) = parts.next() {
            if decimal_str.starts_with('+') || decimal_str.starts_with('-') {
                return Err(DateParseError::Invalid("invalid epoch-seconds timestamp"));
            }
            if decimal_str.len() > 9 {
                return Err(DateParseError::Invalid("decimal is longer than 9 digits"));
            }
            let missing_places = 9 - decimal_str.len() as isize;
            decimal = <u32>::from_str(decimal_str).map_err(|_| DateParseError::IntParseError)?;
            for _ in 0..missing_places {
                decimal *= 10;
            }
        }
        Ok(Instant::from_secs_and_nanos(whole, decimal))
    }
pub ( crate ) fn parse ( value : & str ) -> Result < Instant , DateParseError > { let mut parts = value . splitn ( 2 , '.' ) ; let ( mut whole , mut decimal ) = ( 0i64 , 0u32 ) ; if let Some ( whole_str ) = parts . next ( ) { whole = < i64 > :: from_str ( whole_str ) . map_err ( | _ | DateParseError :: IntParseError ) ? ; } if let Some ( decimal_str ) = parts . next ( ) { if decimal_str . starts_with ( '+' ) || decimal_str . starts_with ( '-' ) { return Err ( DateParseError :: Invalid ( " " ) ) ; } if decimal_str . len ( ) > 9 { return Err ( DateParseError :: Invalid ( " " ) ) ; } let missing_places = 9 - decimal_str . len ( ) as isize ; decimal = < u32 > :: from_str ( decimal_str ) . map_err ( | _ | DateParseError :: IntParseError ) ? ; for _ in 0 .. missing_places { decimal *= 10 ; } } Ok ( Instant :: from_secs_and_nanos ( whole , decimal ) ) }
Parses the Smithy epoch seconds date-time format into an `Instant`.
Parses the Smithy epoch seconds date - time format into an ` Instant ` .
value
&str
value
&str