Closed
Description
This feature adds the following float related methods to Duration
:
as_secs_f64(&self) -> f64
as_secs_f32(&self) -> f32
from_secs_f64(secs: f64) -> Duration
from_secs_f32(secs: f32) -> Duration
mul_f64(self, rhs: f64) -> Duration
mul_f32(self, rhs: f32) -> Duration
div_f64(self, rhs: f64) -> Duration
div_f32(self, rhs: f64) -> Duration
div_duration
methods are tracked in #63139.
Activity
m-ou-se commentedon Jan 19, 2019
What needs to happen before this can be stabilized?
icefoxen commentedon Jan 23, 2019
The only sane options are "have versions for both", or "
f64
because it's more general and people can always downcast." You can't fit a billion nanoseconds into the 24 bit significand of af32
.Also, yes, what needs to happen for this to stabilize?
newpavlov commentedon Jan 23, 2019
I guess we probably should rename methods to
as_f64_secs
,from_f64_secs
anddiv_duration_f64
, so we will have an option to add analogousf32
methods.smokytheangel0 commentedon Feb 15, 2019
What can I do to help?
aloucks commentedon Feb 23, 2019
as_secs_f64
andfrom_secs_f64
would be more consistent.Rollup merge of rust-lang#59102 - newpavlov:duration_float, r=alexcri…
Rollup merge of rust-lang#59102 - newpavlov:duration_float, r=alexcri…
Rollup merge of rust-lang#59102 - newpavlov:duration_float, r=alexcri…
Rollup merge of rust-lang#59102 - newpavlov:duration_float, r=alexcri…
17 remaining items
Use Duration not f64
Use Duration not f64
Use Duration not f64
Use Duration not f64
Use Duration not f64 (#8396)
shadiakiki1986 commentedon Feb 12, 2020
For future-comers, upgrading to
rustc>=1.38
fixes thisReplace durtofl with recently stabilized duration_float
Add duration_float methods
Add duration_float methods
Add duration_float methods
Merge #21