Closed Sh3Rm4n closed 3 years ago
Thank you for the PR! There are a few great points here. First, we are fixing the need to create an object just to get the integer()
by returning a copy of the value rather than a reference.
I hadn't really considered the need to multiply a rate and duration, so thank you for bringing that to my attention. You shouldn't have to get the integer values to do so. That will be rectified.
In addition, #92 will likely add a required scaling_factor()
function implementation (or comparable) to the Duration
and Rate
types, effectively moving the implementation of your added function to the implementation of those traits.
I will accept your PR shortly and target the next release.
For
duration::Generic
orrate::Generic
getting the scaling factor is as easy as callingrate.scaling_factor()
.For examle today I tried to muliply a
Hertz
variable with aMicrosecond
variable. To do this now, needs the followingThis could also introduce subtle bugs, as the
SCALING_FACTOR
call is not bound to thetime
variable.Providing a method, which just returns the value of the associated constant, allows this:
The ergonomics of the
Generic
types are quite nice, but I miss it for the other types.