[partial] Improve fraction retrieval for DicomTime with precision checks #666
[partial] Improve fraction retrieval for DicomTime with precision checks #666Enet4 merged 5 commits intoEnet4:masterfrom
Conversation
|
Thank you for the initiative! In the meantime I have already merged #665, but this can make a great addition to the 0.9 milestone!
An enum might be better, as it forcefully narrows down the precision depth to valid cases (10th of a second, 100th of a second, millisecond, ...). But this can stay an implementation detail as long as the API is expressive and flexible enough. Right now there are a few cases where it's still hard to retrieve the fraction of a second, and relaxing it to enable fetching this fraction regardless of precision may be a good step towards that. Moreover, any method in this module returning |
- remove method fraction as it was ambiguous - add `fraction_ms()` and `fraction_micro()` which are sure to return something unless there is no fraction - add `fraction_precision()` - change `fraction_str` so that it returns `String` and document it
7a3709e to
6e25b7b
Compare
|
I took the liberty of reworking this pull request so that hopefully it will be easier to work with fractions of a second.
|
- unnecessary return
|
Should be good now! Feel free to let me know if you encounter other quirks in this API. |
Hi,
i picked #662 and implemented a solution where leading zeros are not omitted and the value representation of the Date time remains correct. I also added 2 more tests for my change. First time adding to Open Source, hope this helps.
I am not sure if
Option<&u32>is the right choice as return type, or if i should create a new error variant if a mismatch between frac and frac_precision occurs.