@@ -185,8 +185,8 @@ impl FromCqlVal<CqlValue> for NaiveDate {
185185 }
186186}
187187
188- #[ cfg( feature = "time" ) ]
189- impl FromCqlVal < CqlValue > for time :: Date {
188+ #[ cfg( feature = "time-03 " ) ]
189+ impl FromCqlVal < CqlValue > for time_03 :: Date {
190190 fn from_cql ( cql_val : CqlValue ) -> Result < Self , FromCqlValError > {
191191 match cql_val {
192192 CqlValue :: Date ( cql_date) => cql_date. try_into ( ) . map_err ( |_| FromCqlValError :: BadVal ) ,
@@ -205,8 +205,8 @@ impl FromCqlVal<CqlValue> for NaiveTime {
205205 }
206206}
207207
208- #[ cfg( feature = "time" ) ]
209- impl FromCqlVal < CqlValue > for time :: Time {
208+ #[ cfg( feature = "time-03 " ) ]
209+ impl FromCqlVal < CqlValue > for time_03 :: Time {
210210 fn from_cql ( cql_val : CqlValue ) -> Result < Self , FromCqlValError > {
211211 match cql_val {
212212 CqlValue :: Time ( cql_time) => cql_time. try_into ( ) . map_err ( |_| FromCqlValError :: BadVal ) ,
@@ -226,8 +226,8 @@ impl FromCqlVal<CqlValue> for DateTime<Utc> {
226226 }
227227}
228228
229- #[ cfg( feature = "time" ) ]
230- impl FromCqlVal < CqlValue > for time :: OffsetDateTime {
229+ #[ cfg( feature = "time-03 " ) ]
230+ impl FromCqlVal < CqlValue > for time_03 :: OffsetDateTime {
231231 fn from_cql ( cql_val : CqlValue ) -> Result < Self , FromCqlValError > {
232232 cql_val
233233 . as_cql_timestamp ( )
@@ -565,43 +565,49 @@ mod tests {
565565 assert_eq ! ( Ok ( CqlDate ( u32 :: MAX ) ) , CqlDate :: from_cql( max_date) ) ;
566566 }
567567
568- #[ cfg( feature = "time" ) ]
568+ #[ cfg( feature = "time-03 " ) ]
569569 #[ test]
570- fn date_from_cql ( ) {
570+ fn date_03_from_cql ( ) {
571571 // UNIX epoch
572572 let unix_epoch = CqlValue :: Date ( CqlDate ( 1 << 31 ) ) ;
573573 assert_eq ! (
574- Ok ( time :: Date :: from_ordinal_date( 1970 , 1 ) . unwrap( ) ) ,
575- time :: Date :: from_cql( unix_epoch)
574+ Ok ( time_03 :: Date :: from_ordinal_date( 1970 , 1 ) . unwrap( ) ) ,
575+ time_03 :: Date :: from_cql( unix_epoch)
576576 ) ;
577577
578578 // 7 days after UNIX epoch
579579 let after_epoch = CqlValue :: Date ( CqlDate ( ( 1 << 31 ) + 7 ) ) ;
580580 assert_eq ! (
581- Ok ( time :: Date :: from_ordinal_date( 1970 , 8 ) . unwrap( ) ) ,
582- time :: Date :: from_cql( after_epoch)
581+ Ok ( time_03 :: Date :: from_ordinal_date( 1970 , 8 ) . unwrap( ) ) ,
582+ time_03 :: Date :: from_cql( after_epoch)
583583 ) ;
584584
585585 // 3 days before UNIX epoch
586586 let before_epoch = CqlValue :: Date ( CqlDate ( ( 1 << 31 ) - 3 ) ) ;
587587 assert_eq ! (
588- Ok ( time :: Date :: from_ordinal_date( 1969 , 363 ) . unwrap( ) ) ,
589- time :: Date :: from_cql( before_epoch)
588+ Ok ( time_03 :: Date :: from_ordinal_date( 1969 , 363 ) . unwrap( ) ) ,
589+ time_03 :: Date :: from_cql( before_epoch)
590590 ) ;
591591
592- // Min possible stored date. Since value is out of `time ::Date` range, it should return `BadVal` error
592+ // Min possible stored date. Since value is out of `time_03 ::Date` range, it should return `BadVal` error
593593 let min_date = CqlValue :: Date ( CqlDate ( u32:: MIN ) ) ;
594- assert_eq ! ( Err ( FromCqlValError :: BadVal ) , time:: Date :: from_cql( min_date) ) ;
594+ assert_eq ! (
595+ Err ( FromCqlValError :: BadVal ) ,
596+ time_03:: Date :: from_cql( min_date)
597+ ) ;
595598
596- // Max possible stored date. Since value is out of `time ::Date` range, it should return `BadVal` error
599+ // Max possible stored date. Since value is out of `time_03 ::Date` range, it should return `BadVal` error
597600 let max_date = CqlValue :: Date ( CqlDate ( u32:: MAX ) ) ;
598- assert_eq ! ( Err ( FromCqlValError :: BadVal ) , time:: Date :: from_cql( max_date) ) ;
601+ assert_eq ! (
602+ Err ( FromCqlValError :: BadVal ) ,
603+ time_03:: Date :: from_cql( max_date)
604+ ) ;
599605
600- // Different CQL type. Since value can't be casted , it should return `BadCqlType` error
606+ // Different CQL type. Since value can't be cast , it should return `BadCqlType` error
601607 let bad_type = CqlValue :: Double ( 0.5 ) ;
602608 assert_eq ! (
603609 Err ( FromCqlValError :: BadCqlType ) ,
604- time :: Date :: from_cql( bad_type)
610+ time_03 :: Date :: from_cql( bad_type)
605611 ) ;
606612 }
607613
@@ -658,56 +664,59 @@ mod tests {
658664 let bad_time2 = CqlValue :: Time ( CqlTime ( i64:: MAX ) ) ;
659665 assert_eq ! ( Err ( FromCqlValError :: BadVal ) , NaiveTime :: from_cql( bad_time2) ) ;
660666
661- // Different CQL type. Since value can't be casted , it should return `BadCqlType` error
667+ // Different CQL type. Since value can't be cast , it should return `BadCqlType` error
662668 let bad_type = CqlValue :: Double ( 0.5 ) ;
663669 assert_eq ! (
664670 Err ( FromCqlValError :: BadCqlType ) ,
665671 NaiveTime :: from_cql( bad_type)
666672 ) ;
667673 }
668674
669- #[ cfg( feature = "time" ) ]
675+ #[ cfg( feature = "time-03 " ) ]
670676 #[ test]
671- fn time_from_cql ( ) {
677+ fn time_03_from_cql ( ) {
672678 // Midnight
673679 let midnight = CqlValue :: Time ( CqlTime ( 0 ) ) ;
674- assert_eq ! ( Ok ( time:: Time :: MIDNIGHT ) , time:: Time :: from_cql( midnight) ) ;
680+ assert_eq ! (
681+ Ok ( time_03:: Time :: MIDNIGHT ) ,
682+ time_03:: Time :: from_cql( midnight)
683+ ) ;
675684
676685 // 7:15:21.123456789
677686 let morning = CqlValue :: Time ( CqlTime (
678687 ( 7 * 3600 + 15 * 60 + 21 ) * 1_000_000_000 + 123_456_789 ,
679688 ) ) ;
680689 assert_eq ! (
681- Ok ( time :: Time :: from_hms_nano( 7 , 15 , 21 , 123_456_789 ) . unwrap( ) ) ,
682- time :: Time :: from_cql( morning)
690+ Ok ( time_03 :: Time :: from_hms_nano( 7 , 15 , 21 , 123_456_789 ) . unwrap( ) ) ,
691+ time_03 :: Time :: from_cql( morning)
683692 ) ;
684693
685694 // 23:59:59.999999999
686695 let late_night = CqlValue :: Time ( CqlTime (
687696 ( 23 * 3600 + 59 * 60 + 59 ) * 1_000_000_000 + 999_999_999 ,
688697 ) ) ;
689698 assert_eq ! (
690- Ok ( time :: Time :: from_hms_nano( 23 , 59 , 59 , 999_999_999 ) . unwrap( ) ) ,
691- time :: Time :: from_cql( late_night)
699+ Ok ( time_03 :: Time :: from_hms_nano( 23 , 59 , 59 , 999_999_999 ) . unwrap( ) ) ,
700+ time_03 :: Time :: from_cql( late_night)
692701 ) ;
693702
694- // Bad values. Since value is out of `time ::Time` range, it should return `BadVal` error
703+ // Bad values. Since value is out of `time_03 ::Time` range, it should return `BadVal` error
695704 let bad_time1 = CqlValue :: Time ( CqlTime ( -1 ) ) ;
696705 assert_eq ! (
697706 Err ( FromCqlValError :: BadVal ) ,
698- time :: Time :: from_cql( bad_time1)
707+ time_03 :: Time :: from_cql( bad_time1)
699708 ) ;
700709 let bad_time2 = CqlValue :: Time ( CqlTime ( i64:: MAX ) ) ;
701710 assert_eq ! (
702711 Err ( FromCqlValError :: BadVal ) ,
703- time :: Time :: from_cql( bad_time2)
712+ time_03 :: Time :: from_cql( bad_time2)
704713 ) ;
705714
706- // Different CQL type. Since value can't be casted , it should return `BadCqlType` error
715+ // Different CQL type. Since value can't be cast , it should return `BadCqlType` error
707716 let bad_type = CqlValue :: Double ( 0.5 ) ;
708717 assert_eq ! (
709718 Err ( FromCqlValError :: BadCqlType ) ,
710- time :: Time :: from_cql( bad_type)
719+ time_03 :: Time :: from_cql( bad_type)
711720 ) ;
712721 }
713722
@@ -741,55 +750,55 @@ mod tests {
741750 ) ;
742751 }
743752
744- #[ cfg( feature = "time" ) ]
753+ #[ cfg( feature = "time-03 " ) ]
745754 #[ test]
746- fn offset_datetime_from_cql ( ) {
755+ fn offset_datetime_03_from_cql ( ) {
747756 // UNIX epoch
748757 let unix_epoch = CqlValue :: Timestamp ( CqlTimestamp ( 0 ) ) ;
749758 assert_eq ! (
750- Ok ( time :: OffsetDateTime :: UNIX_EPOCH ) ,
751- time :: OffsetDateTime :: from_cql( unix_epoch)
759+ Ok ( time_03 :: OffsetDateTime :: UNIX_EPOCH ) ,
760+ time_03 :: OffsetDateTime :: from_cql( unix_epoch)
752761 ) ;
753762
754763 // 1 day 2 hours 3 minutes 4 seconds and 5 nanoseconds before UNIX epoch
755764 let before_epoch = CqlValue :: Timestamp ( CqlTimestamp ( -( 26 * 3600 + 3 * 60 + 4 ) * 1000 - 5 ) ) ;
756765 assert_eq ! (
757- Ok ( time :: OffsetDateTime :: UNIX_EPOCH
758- - time :: Duration :: new( 26 * 3600 + 3 * 60 + 4 , 5 * 1_000_000 ) ) ,
759- time :: OffsetDateTime :: from_cql( before_epoch)
766+ Ok ( time_03 :: OffsetDateTime :: UNIX_EPOCH
767+ - time_03 :: Duration :: new( 26 * 3600 + 3 * 60 + 4 , 5 * 1_000_000 ) ) ,
768+ time_03 :: OffsetDateTime :: from_cql( before_epoch)
760769 ) ;
761770
762771 // 6 days 7 hours 8 minutes 9 seconds and 10 nanoseconds after UNIX epoch
763772 let after_epoch =
764773 CqlValue :: Timestamp ( CqlTimestamp ( ( ( 6 * 24 + 7 ) * 3600 + 8 * 60 + 9 ) * 1000 + 10 ) ) ;
765774 assert_eq ! (
766- Ok ( time :: PrimitiveDateTime :: new(
767- time :: Date :: from_ordinal_date( 1970 , 7 ) . unwrap( ) ,
768- time :: Time :: from_hms_milli( 7 , 8 , 9 , 10 ) . unwrap( )
775+ Ok ( time_03 :: PrimitiveDateTime :: new(
776+ time_03 :: Date :: from_ordinal_date( 1970 , 7 ) . unwrap( ) ,
777+ time_03 :: Time :: from_hms_milli( 7 , 8 , 9 , 10 ) . unwrap( )
769778 )
770779 . assume_utc( ) ) ,
771- time :: OffsetDateTime :: from_cql( after_epoch)
780+ time_03 :: OffsetDateTime :: from_cql( after_epoch)
772781 ) ;
773782
774- // Min possible stored timestamp. Since value is out of `time ::OffsetDateTime` range, it should return `BadVal` error
783+ // Min possible stored timestamp. Since value is out of `time_03 ::OffsetDateTime` range, it should return `BadVal` error
775784 let min_timestamp = CqlValue :: Timestamp ( CqlTimestamp ( i64:: MIN ) ) ;
776785 assert_eq ! (
777786 Err ( FromCqlValError :: BadVal ) ,
778- time :: OffsetDateTime :: from_cql( min_timestamp)
787+ time_03 :: OffsetDateTime :: from_cql( min_timestamp)
779788 ) ;
780789
781- // Max possible stored timestamp. Since value is out of `time ::OffsetDateTime` range, it should return `BadVal` error
790+ // Max possible stored timestamp. Since value is out of `time_03 ::OffsetDateTime` range, it should return `BadVal` error
782791 let max_timestamp = CqlValue :: Timestamp ( CqlTimestamp ( i64:: MAX ) ) ;
783792 assert_eq ! (
784793 Err ( FromCqlValError :: BadVal ) ,
785- time :: OffsetDateTime :: from_cql( max_timestamp)
794+ time_03 :: OffsetDateTime :: from_cql( max_timestamp)
786795 ) ;
787796
788- // Different CQL type. Since value can't be casted , it should return `BadCqlType` error
797+ // Different CQL type. Since value can't be cast , it should return `BadCqlType` error
789798 let bad_type = CqlValue :: Double ( 0.5 ) ;
790799 assert_eq ! (
791800 Err ( FromCqlValError :: BadCqlType ) ,
792- time :: OffsetDateTime :: from_cql( bad_type)
801+ time_03 :: OffsetDateTime :: from_cql( bad_type)
793802 ) ;
794803 }
795804
0 commit comments