fn build(mut self) -> IonResult<Timestamp> {
        if let Some(offset) = self.offset {
            let offset = FixedOffset::west_opt(offset).ok_or_else(|| {
                illegal_operation_raw(format!("specified offset ('{}') is invalid", offset))
            })?;
            let mut datetime: DateTime<FixedOffset> = offset.ymd(0, 1, 1).and_hms_nano(0, 0, 0, 0);
            datetime = self.configure_datetime(datetime)?;
            let mut timestamp = Timestamp::from_datetime(datetime, self.precision);
            if self.precision == Precision::FractionalSeconds {
                timestamp.fractional_seconds = self.fractional_seconds;
            }
            Ok(timestamp)
        } else {
            let mut datetime: NaiveDateTime = NaiveDate::from_ymd(0, 1, 1).and_hms_nano(0, 0, 0, 0);
            datetime = self.configure_datetime(datetime)?;
            let mut timestamp = Timestamp::from_datetime(datetime, self.precision);
            if self.precision == Precision::FractionalSeconds {
                timestamp.fractional_seconds = self.fractional_seconds;
            }
            Ok(timestamp)
        }
    }
/// Attempt to construct a [Timestamp] using the values configured on the [TimestampBuilder].
/// If any of the individual fields are invalid (for example, a `month` value that is greater
/// than `12`) or if the resulting timestamp would represent a non-existent point in time
/// (like those bypassed by daylight saving time), this method will return an `Err(IonError)`.
Attempt to construct a [Timestamp] using the values configured on the [TimestampBuilder].
Attempt to construct a [ Timestamp ] using the values configured on the [ TimestampBuilder ] .
fn build(mut self) -> IonResult<Timestamp> {
        if let Some(offset) = self.offset {
            let offset = FixedOffset::west_opt(offset).ok_or_else(|| {
                illegal_operation_raw(format!("specified offset ('{}') is invalid", offset))
            })?;
            let mut datetime: DateTime<FixedOffset> = offset.ymd(0, 1, 1).and_hms_nano(0, 0, 0, 0);
            datetime = self.configure_datetime(datetime)?;
            let mut timestamp = Timestamp::from_datetime(datetime, self.precision);
            if self.precision == Precision::FractionalSeconds {
                timestamp.fractional_seconds = self.fractional_seconds;
            }
            Ok(timestamp)
        } else {
            let mut datetime: NaiveDateTime = NaiveDate::from_ymd(0, 1, 1).and_hms_nano(0, 0, 0, 0);
            datetime = self.configure_datetime(datetime)?;
            let mut timestamp = Timestamp::from_datetime(datetime, self.precision);
            if self.precision == Precision::FractionalSeconds {
                timestamp.fractional_seconds = self.fractional_seconds;
            }
            Ok(timestamp)
        }
    }
fn build ( mut self ) -> IonResult < Timestamp > { if let Some ( offset ) = self . offset { let offset = FixedOffset :: west_opt ( offset ) . ok_or_else ( | | { illegal_operation_raw ( format ! ( " " offset ) ) } ) ? ; let mut datetime : DateTime < FixedOffset > = offset . ymd ( 0 , 1 , 1 ) . and_hms_nano ( 0 , 0 , 0 , 0 ) ; datetime = self . configure_datetime ( datetime ) ? ; let mut timestamp = Timestamp :: from_datetime ( datetime , self . precision ) ; if self . precision == Precision :: FractionalSeconds { timestamp . fractional_seconds = self . fractional_seconds ; } Ok ( timestamp ) } else { let mut datetime : NaiveDateTime = NaiveDate :: from_ymd ( 0 , 1 , 1 ) . and_hms_nano ( 0 , 0 , 0 , 0 ) ; datetime = self . configure_datetime ( datetime ) ? ; let mut timestamp = Timestamp :: from_datetime ( datetime , self . precision ) ; if self . precision == Precision :: FractionalSeconds { timestamp . fractional_seconds = self . fractional_seconds ; } Ok ( timestamp ) } }
Attempt to construct a [Timestamp] using the values configured on the [TimestampBuilder].
Attempt to construct a [ Timestamp ] using the values configured on the [ TimestampBuilder ] .
mut self
mut self