@ -52,6 +52,7 @@ impl DateTime {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
Self {
Self {
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
@ -60,47 +61,55 @@ impl DateTime {
/// [fn:year-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-year-from-dateTime)
/// [fn:year-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-year-from-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn year ( self ) -> i64 {
pub fn year ( self ) -> i64 {
self . timestamp . year ( )
self . timestamp . year ( )
}
}
/// [fn:month-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-month-from-dateTime)
/// [fn:month-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-month-from-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn month ( self ) -> u8 {
pub fn month ( self ) -> u8 {
self . timestamp . month ( )
self . timestamp . month ( )
}
}
/// [fn:day-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-day-from-dateTime)
/// [fn:day-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-day-from-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn day ( self ) -> u8 {
pub fn day ( self ) -> u8 {
self . timestamp . day ( )
self . timestamp . day ( )
}
}
/// [fn:hour-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-hours-from-dateTime)
/// [fn:hour-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-hours-from-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn hour ( self ) -> u8 {
pub fn hour ( self ) -> u8 {
self . timestamp . hour ( )
self . timestamp . hour ( )
}
}
/// [fn:minute-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-minutes-from-dateTime)
/// [fn:minute-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-minutes-from-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn minute ( self ) -> u8 {
pub fn minute ( self ) -> u8 {
self . timestamp . minute ( )
self . timestamp . minute ( )
}
}
/// [fn:second-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-seconds-from-dateTime)
/// [fn:second-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-seconds-from-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn second ( self ) -> Decimal {
pub fn second ( self ) -> Decimal {
self . timestamp . second ( )
self . timestamp . second ( )
}
}
/// [fn:timezone-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-timezone-from-dateTime)
/// [fn:timezone-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-timezone-from-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone ( self ) -> Option < DayTimeDuration > {
pub fn timezone ( self ) -> Option < DayTimeDuration > {
Some ( self . timezone_offset ( ) ? . into ( ) )
Some ( self . timezone_offset ( ) ? . into ( ) )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone_offset ( self ) -> Option < TimezoneOffset > {
pub fn timezone_offset ( self ) -> Option < TimezoneOffset > {
self . timestamp . timezone_offset ( )
self . timestamp . timezone_offset ( )
}
}
@ -119,18 +128,21 @@ impl DateTime {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
self . timestamp . to_be_bytes ( )
self . timestamp . to_be_bytes ( )
}
}
/// [op:subtract-dateTimes](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dateTimes)
/// [op:subtract-dateTimes](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dateTimes)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub ( self , rhs : impl Into < Self > ) -> Option < DayTimeDuration > {
pub fn checked_sub ( self , rhs : impl Into < Self > ) -> Option < DayTimeDuration > {
self . timestamp . checked_sub ( rhs . into ( ) . timestamp )
self . timestamp . checked_sub ( rhs . into ( ) . timestamp )
}
}
/// [op:add-yearMonthDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-dateTime)
/// [op:add-yearMonthDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_add_year_month_duration (
pub fn checked_add_year_month_duration (
self ,
self ,
rhs : impl Into < YearMonthDuration > ,
rhs : impl Into < YearMonthDuration > ,
@ -140,6 +152,7 @@ impl DateTime {
/// [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-dateTime)
/// [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_add_day_time_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
pub fn checked_add_day_time_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
let rhs = rhs . into ( ) ;
let rhs = rhs . into ( ) ;
Some ( Self {
Some ( Self {
@ -149,6 +162,7 @@ impl DateTime {
/// [op:add-yearMonthDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-dateTime) and [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-dateTime)
/// [op:add-yearMonthDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-dateTime) and [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_add_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
pub fn checked_add_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
let rhs = rhs . into ( ) ;
let rhs = rhs . into ( ) ;
if let Ok ( rhs ) = DayTimeDuration ::try_from ( rhs ) {
if let Ok ( rhs ) = DayTimeDuration ::try_from ( rhs ) {
@ -163,6 +177,7 @@ impl DateTime {
/// [op:subtract-yearMonthDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-dateTime)
/// [op:subtract-yearMonthDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub_year_month_duration (
pub fn checked_sub_year_month_duration (
self ,
self ,
rhs : impl Into < YearMonthDuration > ,
rhs : impl Into < YearMonthDuration > ,
@ -172,6 +187,7 @@ impl DateTime {
/// [op:subtract-dayTimeDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-dateTime)
/// [op:subtract-dayTimeDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub_day_time_duration ( self , rhs : impl Into < DayTimeDuration > ) -> Option < Self > {
pub fn checked_sub_day_time_duration ( self , rhs : impl Into < DayTimeDuration > ) -> Option < Self > {
let rhs = rhs . into ( ) ;
let rhs = rhs . into ( ) ;
Some ( Self {
Some ( Self {
@ -181,6 +197,7 @@ impl DateTime {
/// [op:subtract-yearMonthDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-dateTime) and [op:subtract-dayTimeDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-dateTime)
/// [op:subtract-yearMonthDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-dateTime) and [op:subtract-dayTimeDuration-from-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-dateTime)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
pub fn checked_sub_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
let rhs = rhs . into ( ) ;
let rhs = rhs . into ( ) ;
if let Ok ( rhs ) = DayTimeDuration ::try_from ( rhs ) {
if let Ok ( rhs ) = DayTimeDuration ::try_from ( rhs ) {
@ -198,6 +215,7 @@ impl DateTime {
/// [fn:adjust-dateTime-to-timezone](https://www.w3.org/TR/xpath-functions-31/#func-adjust-dateTime-to-timezone)
/// [fn:adjust-dateTime-to-timezone](https://www.w3.org/TR/xpath-functions-31/#func-adjust-dateTime-to-timezone)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn adjust ( self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
pub fn adjust ( self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
Some ( Self {
Some ( Self {
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
@ -206,6 +224,7 @@ impl DateTime {
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn is_identical_with ( self , other : Self ) -> bool {
pub fn is_identical_with ( self , other : Self ) -> bool {
self . timestamp . is_identical_with ( other . timestamp )
self . timestamp . is_identical_with ( other . timestamp )
}
}
@ -300,6 +319,7 @@ impl Time {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
Self {
Self {
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
@ -314,52 +334,61 @@ impl Time {
/// [fn:hour-from-time](https://www.w3.org/TR/xpath-functions-31/#func-hours-from-time)
/// [fn:hour-from-time](https://www.w3.org/TR/xpath-functions-31/#func-hours-from-time)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn hour ( self ) -> u8 {
pub fn hour ( self ) -> u8 {
self . timestamp . hour ( )
self . timestamp . hour ( )
}
}
/// [fn:minute-from-time](https://www.w3.org/TR/xpath-functions-31/#func-minutes-from-time)
/// [fn:minute-from-time](https://www.w3.org/TR/xpath-functions-31/#func-minutes-from-time)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn minute ( self ) -> u8 {
pub fn minute ( self ) -> u8 {
self . timestamp . minute ( )
self . timestamp . minute ( )
}
}
/// [fn:second-from-time](https://www.w3.org/TR/xpath-functions-31/#func-seconds-from-time)
/// [fn:second-from-time](https://www.w3.org/TR/xpath-functions-31/#func-seconds-from-time)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn second ( self ) -> Decimal {
pub fn second ( self ) -> Decimal {
self . timestamp . second ( )
self . timestamp . second ( )
}
}
/// [fn:timezone-from-time](https://www.w3.org/TR/xpath-functions-31/#func-timezone-from-time)
/// [fn:timezone-from-time](https://www.w3.org/TR/xpath-functions-31/#func-timezone-from-time)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone ( self ) -> Option < DayTimeDuration > {
pub fn timezone ( self ) -> Option < DayTimeDuration > {
Some ( self . timezone_offset ( ) ? . into ( ) )
Some ( self . timezone_offset ( ) ? . into ( ) )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone_offset ( self ) -> Option < TimezoneOffset > {
pub fn timezone_offset ( self ) -> Option < TimezoneOffset > {
self . timestamp . timezone_offset ( )
self . timestamp . timezone_offset ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
self . timestamp . to_be_bytes ( )
self . timestamp . to_be_bytes ( )
}
}
/// [op:subtract-times](https://www.w3.org/TR/xpath-functions-31/#func-subtract-times)
/// [op:subtract-times](https://www.w3.org/TR/xpath-functions-31/#func-subtract-times)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub ( self , rhs : impl Into < Self > ) -> Option < DayTimeDuration > {
pub fn checked_sub ( self , rhs : impl Into < Self > ) -> Option < DayTimeDuration > {
self . timestamp . checked_sub ( rhs . into ( ) . timestamp )
self . timestamp . checked_sub ( rhs . into ( ) . timestamp )
}
}
/// [op:add-dayTimeDuration-to-time](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-time)
/// [op:add-dayTimeDuration-to-time](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-time)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_add_day_time_duration ( self , rhs : impl Into < DayTimeDuration > ) -> Option < Self > {
pub fn checked_add_day_time_duration ( self , rhs : impl Into < DayTimeDuration > ) -> Option < Self > {
self . checked_add_duration ( Duration ::from ( rhs . into ( ) ) )
self . checked_add_duration ( Duration ::from ( rhs . into ( ) ) )
}
}
/// [op:add-dayTimeDuration-to-time](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-time)
/// [op:add-dayTimeDuration-to-time](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-time)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_add_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
pub fn checked_add_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
DateTime ::new (
DateTime ::new (
1972 ,
1972 ,
@ -378,12 +407,14 @@ impl Time {
/// [op:subtract-dayTimeDuration-from-time](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-time)
/// [op:subtract-dayTimeDuration-from-time](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-time)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub_day_time_duration ( self , rhs : impl Into < DayTimeDuration > ) -> Option < Self > {
pub fn checked_sub_day_time_duration ( self , rhs : impl Into < DayTimeDuration > ) -> Option < Self > {
self . checked_sub_duration ( Duration ::from ( rhs . into ( ) ) )
self . checked_sub_duration ( Duration ::from ( rhs . into ( ) ) )
}
}
/// [op:subtract-dayTimeDuration-from-time](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-time)
/// [op:subtract-dayTimeDuration-from-time](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-time)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
pub fn checked_sub_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
DateTime ::new (
DateTime ::new (
1972 ,
1972 ,
@ -402,6 +433,7 @@ impl Time {
// [fn:adjust-time-to-timezone](https://www.w3.org/TR/xpath-functions-31/#func-adjust-time-to-timezone)
// [fn:adjust-time-to-timezone](https://www.w3.org/TR/xpath-functions-31/#func-adjust-time-to-timezone)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn adjust ( self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
pub fn adjust ( self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
DateTime ::new (
DateTime ::new (
1972 ,
1972 ,
@ -420,6 +452,7 @@ impl Time {
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn is_identical_with ( self , other : Self ) -> bool {
pub fn is_identical_with ( self , other : Self ) -> bool {
self . timestamp . is_identical_with ( other . timestamp )
self . timestamp . is_identical_with ( other . timestamp )
}
}
@ -501,6 +534,7 @@ impl Date {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
Self {
Self {
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
@ -515,46 +549,54 @@ impl Date {
/// [fn:year-from-date](https://www.w3.org/TR/xpath-functions-31/#func-year-from-date)
/// [fn:year-from-date](https://www.w3.org/TR/xpath-functions-31/#func-year-from-date)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn year ( self ) -> i64 {
pub fn year ( self ) -> i64 {
self . timestamp . year ( )
self . timestamp . year ( )
}
}
/// [fn:month-from-date](https://www.w3.org/TR/xpath-functions-31/#func-month-from-date)
/// [fn:month-from-date](https://www.w3.org/TR/xpath-functions-31/#func-month-from-date)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn month ( self ) -> u8 {
pub fn month ( self ) -> u8 {
self . timestamp . month ( )
self . timestamp . month ( )
}
}
/// [fn:day-from-date](https://www.w3.org/TR/xpath-functions-31/#func-day-from-date)
/// [fn:day-from-date](https://www.w3.org/TR/xpath-functions-31/#func-day-from-date)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn day ( self ) -> u8 {
pub fn day ( self ) -> u8 {
self . timestamp . day ( )
self . timestamp . day ( )
}
}
/// [fn:timezone-from-date](https://www.w3.org/TR/xpath-functions-31/#func-timezone-from-date)
/// [fn:timezone-from-date](https://www.w3.org/TR/xpath-functions-31/#func-timezone-from-date)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone ( self ) -> Option < DayTimeDuration > {
pub fn timezone ( self ) -> Option < DayTimeDuration > {
Some ( self . timezone_offset ( ) ? . into ( ) )
Some ( self . timezone_offset ( ) ? . into ( ) )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone_offset ( self ) -> Option < TimezoneOffset > {
pub fn timezone_offset ( self ) -> Option < TimezoneOffset > {
self . timestamp . timezone_offset ( )
self . timestamp . timezone_offset ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
self . timestamp . to_be_bytes ( )
self . timestamp . to_be_bytes ( )
}
}
/// [op:subtract-dates](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dates)
/// [op:subtract-dates](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dates)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub ( self , rhs : impl Into < Self > ) -> Option < DayTimeDuration > {
pub fn checked_sub ( self , rhs : impl Into < Self > ) -> Option < DayTimeDuration > {
self . timestamp . checked_sub ( rhs . into ( ) . timestamp )
self . timestamp . checked_sub ( rhs . into ( ) . timestamp )
}
}
/// [op:add-yearMonthDuration-to-date](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-date)
/// [op:add-yearMonthDuration-to-date](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-date)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_add_year_month_duration (
pub fn checked_add_year_month_duration (
self ,
self ,
rhs : impl Into < YearMonthDuration > ,
rhs : impl Into < YearMonthDuration > ,
@ -564,12 +606,14 @@ impl Date {
/// [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-date)
/// [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-date)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_add_day_time_duration ( self , rhs : impl Into < DayTimeDuration > ) -> Option < Self > {
pub fn checked_add_day_time_duration ( self , rhs : impl Into < DayTimeDuration > ) -> Option < Self > {
self . checked_add_duration ( Duration ::from ( rhs . into ( ) ) )
self . checked_add_duration ( Duration ::from ( rhs . into ( ) ) )
}
}
/// [op:add-yearMonthDuration-to-date](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-date) and [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-date)
/// [op:add-yearMonthDuration-to-date](https://www.w3.org/TR/xpath-functions-31/#func-add-yearMonthDuration-to-date) and [op:add-dayTimeDuration-to-dateTime](https://www.w3.org/TR/xpath-functions-31/#func-add-dayTimeDuration-to-date)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_add_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
pub fn checked_add_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
DateTime ::try_from ( self )
DateTime ::try_from ( self )
. ok ( ) ?
. ok ( ) ?
@ -580,6 +624,7 @@ impl Date {
/// [op:subtract-yearMonthDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-date)
/// [op:subtract-yearMonthDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-date)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub_year_month_duration (
pub fn checked_sub_year_month_duration (
self ,
self ,
rhs : impl Into < YearMonthDuration > ,
rhs : impl Into < YearMonthDuration > ,
@ -589,12 +634,14 @@ impl Date {
/// [op:subtract-dayTimeDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-date)
/// [op:subtract-dayTimeDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-date)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub_day_time_duration ( self , rhs : impl Into < DayTimeDuration > ) -> Option < Self > {
pub fn checked_sub_day_time_duration ( self , rhs : impl Into < DayTimeDuration > ) -> Option < Self > {
self . checked_sub_duration ( Duration ::from ( rhs . into ( ) ) )
self . checked_sub_duration ( Duration ::from ( rhs . into ( ) ) )
}
}
/// [op:subtract-yearMonthDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-date) and [op:subtract-dayTimeDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-date)
/// [op:subtract-yearMonthDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-yearMonthDuration-from-date) and [op:subtract-dayTimeDuration-from-date](https://www.w3.org/TR/xpath-functions-31/#func-subtract-dayTimeDuration-from-date)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn checked_sub_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
pub fn checked_sub_duration ( self , rhs : impl Into < Duration > ) -> Option < Self > {
DateTime ::try_from ( self )
DateTime ::try_from ( self )
. ok ( ) ?
. ok ( ) ?
@ -605,6 +652,7 @@ impl Date {
// [fn:adjust-date-to-timezone](https://www.w3.org/TR/xpath-functions-31/#func-adjust-date-to-timezone)
// [fn:adjust-date-to-timezone](https://www.w3.org/TR/xpath-functions-31/#func-adjust-date-to-timezone)
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn adjust ( self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
pub fn adjust ( self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
DateTime ::new (
DateTime ::new (
self . year ( ) ,
self . year ( ) ,
@ -623,6 +671,7 @@ impl Date {
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn is_identical_with ( self , other : Self ) -> bool {
pub fn is_identical_with ( self , other : Self ) -> bool {
self . timestamp . is_identical_with ( other . timestamp )
self . timestamp . is_identical_with ( other . timestamp )
}
}
@ -696,6 +745,7 @@ impl GYearMonth {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
Self {
Self {
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
@ -703,26 +753,31 @@ impl GYearMonth {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn year ( self ) -> i64 {
pub fn year ( self ) -> i64 {
self . timestamp . year ( )
self . timestamp . year ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn month ( self ) -> u8 {
pub fn month ( self ) -> u8 {
self . timestamp . month ( )
self . timestamp . month ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone ( self ) -> Option < DayTimeDuration > {
pub fn timezone ( self ) -> Option < DayTimeDuration > {
Some ( self . timezone_offset ( ) ? . into ( ) )
Some ( self . timezone_offset ( ) ? . into ( ) )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone_offset ( self ) -> Option < TimezoneOffset > {
pub fn timezone_offset ( self ) -> Option < TimezoneOffset > {
self . timestamp . timezone_offset ( )
self . timestamp . timezone_offset ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn adjust ( self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
pub fn adjust ( self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
Some ( Self {
Some ( Self {
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
@ -730,12 +785,14 @@ impl GYearMonth {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
self . timestamp . to_be_bytes ( )
self . timestamp . to_be_bytes ( )
}
}
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn is_identical_with ( self , other : Self ) -> bool {
pub fn is_identical_with ( self , other : Self ) -> bool {
self . timestamp . is_identical_with ( other . timestamp )
self . timestamp . is_identical_with ( other . timestamp )
}
}
@ -817,6 +874,7 @@ impl GYear {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
Self {
Self {
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
@ -824,21 +882,25 @@ impl GYear {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn year ( self ) -> i64 {
pub fn year ( self ) -> i64 {
self . timestamp . year ( )
self . timestamp . year ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone ( self ) -> Option < DayTimeDuration > {
pub fn timezone ( self ) -> Option < DayTimeDuration > {
Some ( self . timezone_offset ( ) ? . into ( ) )
Some ( self . timezone_offset ( ) ? . into ( ) )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone_offset ( self ) -> Option < TimezoneOffset > {
pub fn timezone_offset ( self ) -> Option < TimezoneOffset > {
self . timestamp . timezone_offset ( )
self . timestamp . timezone_offset ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn adjust ( self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
pub fn adjust ( self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
Some ( Self {
Some ( Self {
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
@ -846,12 +908,14 @@ impl GYear {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
self . timestamp . to_be_bytes ( )
self . timestamp . to_be_bytes ( )
}
}
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn is_identical_with ( self , other : Self ) -> bool {
pub fn is_identical_with ( self , other : Self ) -> bool {
self . timestamp . is_identical_with ( other . timestamp )
self . timestamp . is_identical_with ( other . timestamp )
}
}
@ -939,6 +1003,7 @@ impl GMonthDay {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
Self {
Self {
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
@ -946,26 +1011,31 @@ impl GMonthDay {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn month ( & self ) -> u8 {
pub fn month ( & self ) -> u8 {
self . timestamp . month ( )
self . timestamp . month ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn day ( & self ) -> u8 {
pub fn day ( & self ) -> u8 {
self . timestamp . day ( )
self . timestamp . day ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone ( & self ) -> Option < DayTimeDuration > {
pub fn timezone ( & self ) -> Option < DayTimeDuration > {
Some ( self . timezone_offset ( ) ? . into ( ) )
Some ( self . timezone_offset ( ) ? . into ( ) )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone_offset ( & self ) -> Option < TimezoneOffset > {
pub fn timezone_offset ( & self ) -> Option < TimezoneOffset > {
self . timestamp . timezone_offset ( )
self . timestamp . timezone_offset ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn adjust ( & self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
pub fn adjust ( & self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
Some ( Self {
Some ( Self {
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
@ -973,12 +1043,14 @@ impl GMonthDay {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
self . timestamp . to_be_bytes ( )
self . timestamp . to_be_bytes ( )
}
}
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn is_identical_with ( self , other : Self ) -> bool {
pub fn is_identical_with ( self , other : Self ) -> bool {
self . timestamp . is_identical_with ( other . timestamp )
self . timestamp . is_identical_with ( other . timestamp )
}
}
@ -1056,6 +1128,7 @@ impl GMonth {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
Self {
Self {
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
@ -1063,21 +1136,25 @@ impl GMonth {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn month ( & self ) -> u8 {
pub fn month ( & self ) -> u8 {
self . timestamp . month ( )
self . timestamp . month ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone ( & self ) -> Option < DayTimeDuration > {
pub fn timezone ( & self ) -> Option < DayTimeDuration > {
Some ( self . timezone_offset ( ) ? . into ( ) )
Some ( self . timezone_offset ( ) ? . into ( ) )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone_offset ( & self ) -> Option < TimezoneOffset > {
pub fn timezone_offset ( & self ) -> Option < TimezoneOffset > {
self . timestamp . timezone_offset ( )
self . timestamp . timezone_offset ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn adjust ( & self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
pub fn adjust ( & self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
Some ( Self {
Some ( Self {
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
@ -1085,12 +1162,14 @@ impl GMonth {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
self . timestamp . to_be_bytes ( )
self . timestamp . to_be_bytes ( )
}
}
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn is_identical_with ( self , other : Self ) -> bool {
pub fn is_identical_with ( self , other : Self ) -> bool {
self . timestamp . is_identical_with ( other . timestamp )
self . timestamp . is_identical_with ( other . timestamp )
}
}
@ -1182,6 +1261,7 @@ impl GDay {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
pub fn from_be_bytes ( bytes : [ u8 ; 18 ] ) -> Self {
Self {
Self {
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
timestamp : Timestamp ::from_be_bytes ( bytes ) ,
@ -1189,21 +1269,25 @@ impl GDay {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn day ( & self ) -> u8 {
pub fn day ( & self ) -> u8 {
self . timestamp . day ( )
self . timestamp . day ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone ( & self ) -> Option < DayTimeDuration > {
pub fn timezone ( & self ) -> Option < DayTimeDuration > {
Some ( self . timezone_offset ( ) ? . into ( ) )
Some ( self . timezone_offset ( ) ? . into ( ) )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn timezone_offset ( & self ) -> Option < TimezoneOffset > {
pub fn timezone_offset ( & self ) -> Option < TimezoneOffset > {
self . timestamp . timezone_offset ( )
self . timestamp . timezone_offset ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn adjust ( & self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
pub fn adjust ( & self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
Some ( Self {
Some ( Self {
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
timestamp : self . timestamp . adjust ( timezone_offset ) ? ,
@ -1211,12 +1295,14 @@ impl GDay {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
pub fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
self . timestamp . to_be_bytes ( )
self . timestamp . to_be_bytes ( )
}
}
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn is_identical_with ( self , other : Self ) -> bool {
pub fn is_identical_with ( self , other : Self ) -> bool {
self . timestamp . is_identical_with ( other . timestamp )
self . timestamp . is_identical_with ( other . timestamp )
}
}
@ -1293,6 +1379,7 @@ impl TimezoneOffset {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn from_be_bytes ( bytes : [ u8 ; 2 ] ) -> Self {
pub fn from_be_bytes ( bytes : [ u8 ; 2 ] ) -> Self {
Self {
Self {
offset : i16 ::from_be_bytes ( bytes ) ,
offset : i16 ::from_be_bytes ( bytes ) ,
@ -1300,6 +1387,7 @@ impl TimezoneOffset {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn to_be_bytes ( self ) -> [ u8 ; 2 ] {
pub fn to_be_bytes ( self ) -> [ u8 ; 2 ] {
self . offset . to_be_bytes ( )
self . offset . to_be_bytes ( )
}
}
@ -1486,6 +1574,7 @@ impl Timestamp {
#[ allow(clippy::cast_possible_truncation, clippy::cast_sign_loss) ]
#[ allow(clippy::cast_possible_truncation, clippy::cast_sign_loss) ]
#[ inline ]
#[ inline ]
#[ must_use ]
fn year_month_day ( & self ) -> ( i64 , u8 , u8 ) {
fn year_month_day ( & self ) -> ( i64 , u8 , u8 ) {
let mut days = ( self . value . as_i128 ( )
let mut days = ( self . value . as_i128 ( )
+ i128 ::from ( self . timezone_offset . unwrap_or ( TimezoneOffset ::UTC ) . offset ) * 60 )
+ i128 ::from ( self . timezone_offset . unwrap_or ( TimezoneOffset ::UTC ) . offset ) * 60 )
@ -1537,18 +1626,21 @@ impl Timestamp {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
fn year ( & self ) -> i64 {
fn year ( & self ) -> i64 {
let ( year , _ , _ ) = self . year_month_day ( ) ;
let ( year , _ , _ ) = self . year_month_day ( ) ;
year
year
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
fn month ( & self ) -> u8 {
fn month ( & self ) -> u8 {
let ( _ , month , _ ) = self . year_month_day ( ) ;
let ( _ , month , _ ) = self . year_month_day ( ) ;
month
month
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
fn day ( & self ) -> u8 {
fn day ( & self ) -> u8 {
let ( _ , _ , day ) = self . year_month_day ( ) ;
let ( _ , _ , day ) = self . year_month_day ( ) ;
day
day
@ -1556,6 +1648,7 @@ impl Timestamp {
#[ allow(clippy::cast_possible_truncation, clippy::cast_sign_loss) ]
#[ allow(clippy::cast_possible_truncation, clippy::cast_sign_loss) ]
#[ inline ]
#[ inline ]
#[ must_use ]
fn hour ( & self ) -> u8 {
fn hour ( & self ) -> u8 {
( ( ( self . value . as_i128 ( )
( ( ( self . value . as_i128 ( )
+ i128 ::from ( self . timezone_offset . unwrap_or ( TimezoneOffset ::UTC ) . offset ) * 60 )
+ i128 ::from ( self . timezone_offset . unwrap_or ( TimezoneOffset ::UTC ) . offset ) * 60 )
@ -1565,6 +1658,7 @@ impl Timestamp {
#[ allow(clippy::cast_possible_truncation, clippy::cast_sign_loss) ]
#[ allow(clippy::cast_possible_truncation, clippy::cast_sign_loss) ]
#[ inline ]
#[ inline ]
#[ must_use ]
fn minute ( & self ) -> u8 {
fn minute ( & self ) -> u8 {
( ( ( self . value . as_i128 ( )
( ( ( self . value . as_i128 ( )
+ i128 ::from ( self . timezone_offset . unwrap_or ( TimezoneOffset ::UTC ) . offset ) * 60 )
+ i128 ::from ( self . timezone_offset . unwrap_or ( TimezoneOffset ::UTC ) . offset ) * 60 )
@ -1573,16 +1667,19 @@ impl Timestamp {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
fn second ( & self ) -> Decimal {
fn second ( & self ) -> Decimal {
self . value . checked_rem_euclid ( 60 ) . unwrap ( ) . abs ( )
self . value . checked_rem_euclid ( 60 ) . unwrap ( ) . abs ( )
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
const fn timezone_offset ( & self ) -> Option < TimezoneOffset > {
const fn timezone_offset ( & self ) -> Option < TimezoneOffset > {
self . timezone_offset
self . timezone_offset
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
fn checked_add_seconds ( & self , seconds : impl Into < Decimal > ) -> Option < Self > {
fn checked_add_seconds ( & self , seconds : impl Into < Decimal > ) -> Option < Self > {
Some ( Self {
Some ( Self {
value : self . value . checked_add ( seconds . into ( ) ) ? ,
value : self . value . checked_add ( seconds . into ( ) ) ? ,
@ -1591,6 +1688,7 @@ impl Timestamp {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
fn checked_sub ( & self , rhs : Self ) -> Option < DayTimeDuration > {
fn checked_sub ( & self , rhs : Self ) -> Option < DayTimeDuration > {
match ( self . timezone_offset , rhs . timezone_offset ) {
match ( self . timezone_offset , rhs . timezone_offset ) {
( Some ( _ ) , Some ( _ ) ) | ( None , None ) = > {
( Some ( _ ) , Some ( _ ) ) | ( None , None ) = > {
@ -1601,6 +1699,7 @@ impl Timestamp {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
fn checked_sub_seconds ( & self , seconds : Decimal ) -> Option < Self > {
fn checked_sub_seconds ( & self , seconds : Decimal ) -> Option < Self > {
Some ( Self {
Some ( Self {
value : self . value . checked_sub ( seconds ) ? ,
value : self . value . checked_sub ( seconds ) ? ,
@ -1609,6 +1708,7 @@ impl Timestamp {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
fn adjust ( & self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
fn adjust ( & self , timezone_offset : Option < TimezoneOffset > ) -> Option < Self > {
Some ( if let Some ( from_timezone ) = self . timezone_offset {
Some ( if let Some ( from_timezone ) = self . timezone_offset {
if let Some ( to_timezone ) = timezone_offset {
if let Some ( to_timezone ) = timezone_offset {
@ -1638,6 +1738,7 @@ impl Timestamp {
}
}
#[ inline ]
#[ inline ]
#[ must_use ]
fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
fn to_be_bytes ( self ) -> [ u8 ; 18 ] {
let mut bytes = [ 0 ; 18 ] ;
let mut bytes = [ 0 ; 18 ] ;
bytes [ 0 .. 16 ] . copy_from_slice ( & self . value . to_be_bytes ( ) ) ;
bytes [ 0 .. 16 ] . copy_from_slice ( & self . value . to_be_bytes ( ) ) ;
@ -1650,6 +1751,7 @@ impl Timestamp {
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
/// Checks if the two values are [identical](https://www.w3.org/TR/xmlschema11-2/#identity).
#[ inline ]
#[ inline ]
#[ must_use ]
pub fn is_identical_with ( self , other : Self ) -> bool {
pub fn is_identical_with ( self , other : Self ) -> bool {
self . value = = other . value & & self . timezone_offset = = other . timezone_offset
self . value = = other . value & & self . timezone_offset = = other . timezone_offset
}
}