Depends on D4166
Adding bytesize crate
Differential D4227
[services] Tests - Add byte size crate • karol on Jun 7 2022, 6:50 AM. Authored by Tags None Referenced Files
Details
Diff Detail
Event TimelineComment Actions do we really need this? i ask because the crate only has 67 stars and hasn't been updated in a while. i think it might be better and safer to just keep the sizes as consts. e.g. const MB: u64 = 1_000_000;. then if you need, say, 4MB you can just do 4 * MB Comment Actions
fwiw the author/maintainer looks legit: https://www.linkedin.com/in/hyunsikchoi/ Comment Actions Please include me on all diffs that change dependencies! Details on when to add me can be found here Comment Actions I think 67 stars is fine, it's been updated in the last year, and I agree the maintainer looks legit. That said, I'm concerned that the maintainer doesn't seem to have been answering any GitHub issues recently, and it seems like there are some bugs: https://github.com/hyunsik/bytesize/issues Comment Actions Ok, so at first I wanted to create something like constants.rs with all the stuff like mb, kb, etc. But then I thought: why would we do it manually if we probably can use some lib that has it all plus some helper functions in case we need any. I think it is beneficial to use a library. With that said, if you find the lib I picked too poorly maintained or not suitable for whatever reason, we can look for a different one. As for this lib, I'm not sure if maintenance is that crucial - what can go wrong in defining a few constants? The sizes of kb, mb, gb, tb will never change, right? Back to your queue as we seem divided. Conclusion: I'd stay with what's here, I'd definitely avoid doing it manually if possible (and it is). Comment Actions This library seems useful. Also, even though it has only a couple of stars, it was downloaded from crates 4M times (for the comparison, the most popular crate (rand) has 128M downloads), so it's used in a lot of projects. |