pub fn compute_interval(&self) -> Result<Interval, String> {
        use DateTimeField::*;
        let mut months = 0i64;
        let mut seconds = 0i64;
        let mut nanos = 0i64;

        // Add all DateTimeFields, from Year to Seconds.
        self.add_field(Year, &mut months, &mut seconds, &mut nanos)?;

        for field in Year.into_iter().take_while(|f| *f <= Second) {
            self.add_field(field, &mut months, &mut seconds, &mut nanos)?;
        }

        let months: i32 = match months.try_into() {
            Ok(m) => m,
            Err(_) => {
                return Err(format!(
                    "exceeds min/max months (+/-2147483647); have {}",
                    months
                ))
            }
        };

        match Interval::new(months, seconds, nanos) {
            Ok(i) => Ok(i),
            Err(e) => Err(e.to_string()),
        }
    }
/// Compute an Interval from an ParsedDateTime.
///
/// # Errors
/// - If any component overflows a parameter (i.e. i64).
Compute an Interval from an ParsedDateTime.
Compute an Interval from an ParsedDateTime .
pub fn compute_interval(&self) -> Result<Interval, String> {
        use DateTimeField::*;
        let mut months = 0i64;
        let mut seconds = 0i64;
        let mut nanos = 0i64;
        // Add all DateTimeFields, from Year to Seconds.
        self.add_field(Year, &mut months, &mut seconds, &mut nanos)?;
        for field in Year.into_iter().take_while(|f| *f <= Second) {
            self.add_field(field, &mut months, &mut seconds, &mut nanos)?;
        }
        let months: i32 = match months.try_into() {
            Ok(m) => m,
            Err(_) => {
                return Err(format!(
                    "exceeds min/max months (+/-2147483647); have {}",
                    months
                ))
            }
        };
        match Interval::new(months, seconds, nanos) {
            Ok(i) => Ok(i),
            Err(e) => Err(e.to_string()),
        }
    }
pub fn compute_interval ( & self ) -> Result < Interval , String > { use DateTimeField :: * ; let mut months = 0i64 ; let mut seconds = 0i64 ; let mut nanos = 0i64 ; // Add all DateTimeFields, from Year to Seconds. self . add_field ( Year , & mut months , & mut seconds , & mut nanos ) ? ; for field in Year . into_iter ( ) . take_while ( | f | * f <= Second ) { self . add_field ( field , & mut months , & mut seconds , & mut nanos ) ? ; } let months : i32 = match months . try_into ( ) { Ok ( m ) => m , Err ( _ ) => { return Err ( format ! ( " " months ) ) } } ; match Interval :: new ( months , seconds , nanos ) { Ok ( i ) => Ok ( i ) , Err ( e ) => Err ( e . to_string ( ) ) , } }
Compute an Interval from an ParsedDateTime.
Compute an Interval from an ParsedDateTime .
&self
&self
errors
If any component overflows a parameter .
If any component overflows a parameter .