11#[ cfg( feature = "std" ) ]
22use crate :: Instant ;
33use crate :: {
4- NumberExt , OutOfRangeError ,
4+ NumberExt , ConversionRangeError ,
55 Sign :: { self , Negative , Positive , Zero } ,
66} ;
77use core:: {
@@ -843,7 +843,7 @@ impl Duration {
843843 since = "0.2.0" ,
844844 note = "Use `Duration::try_from(value)` or `value.try_into()`"
845845 ) ]
846- pub fn from_std ( std : StdDuration ) -> Result < Self , OutOfRangeError > {
846+ pub fn from_std ( std : StdDuration ) -> Result < Self , ConversionRangeError > {
847847 std. try_into ( )
848848 }
849849
@@ -853,35 +853,35 @@ impl Duration {
853853 since = "0.2.0" ,
854854 note = "Use `std::time::Duration::try_from(value)` or `value.try_into()`"
855855 ) ]
856- pub fn to_std ( & self ) -> Result < StdDuration , OutOfRangeError > {
856+ pub fn to_std ( & self ) -> Result < StdDuration , ConversionRangeError > {
857857 if self . sign . is_negative ( ) {
858- Err ( OutOfRangeError )
858+ Err ( ConversionRangeError )
859859 } else {
860860 Ok ( self . std )
861861 }
862862 }
863863}
864864
865865impl TryFrom < StdDuration > for Duration {
866- type Error = OutOfRangeError ;
866+ type Error = ConversionRangeError ;
867867
868868 #[ inline( always) ]
869- fn try_from ( original : StdDuration ) -> Result < Self , OutOfRangeError > {
869+ fn try_from ( original : StdDuration ) -> Result < Self , ConversionRangeError > {
870870 some_if_in_range ! ( Self {
871871 sign: original. as_nanos( ) . sign( ) ,
872872 std: original,
873873 } )
874- . ok_or ( OutOfRangeError )
874+ . ok_or ( ConversionRangeError )
875875 }
876876}
877877
878878impl TryFrom < Duration > for StdDuration {
879- type Error = OutOfRangeError ;
879+ type Error = ConversionRangeError ;
880880
881881 #[ inline( always) ]
882- fn try_from ( duration : Duration ) -> Result < Self , OutOfRangeError > {
882+ fn try_from ( duration : Duration ) -> Result < Self , ConversionRangeError > {
883883 if duration. sign . is_negative ( ) {
884- Err ( OutOfRangeError )
884+ Err ( ConversionRangeError )
885885 } else {
886886 Ok ( duration. std )
887887 }
0 commit comments