Skip to content

0.2.0

@mqudsi mqudsi tagged this 17 Jun 21:31
This is a major (and slightly breaking) update to the PrettySize `size` crate,
bringing significant new features, improvements to the API, and a complete
overhaul of the documentation.

The major changes from v0.1.x are outlined below:

* Support for mathematical operations on strongly-typed `Size<T>` sizes, that
  include support for adding and subtracting `Size` instances and for
  multiplying/dividing `Size` instances by scalar values,
* Support (both for creating/handling and for formatting/printing) negative file
  sizes, required to express the potentially negative difference between two
  `Size` values,
* `Size` now implements `PartialEq` so `Size` values can be compared directly
  (instead of having to compare `size1.bytes()` and `size2.bytes()`),
* Abbrevations are now available for the various strongly-typed `Size`
  discriminants, e.g. you can use `let foo = Size::KiB(2);` instead of `let foo
  = Size::Kibibytes(2)` (the resulting type is still the same for both),
* The scalar constants have been moved from the crate root to `size::consts` to
  discourage their use in favor of the strongly-typed `Size<T>` approach,
* `Size` instances can be compared for equality both directly and via
  references,
* `Size` instances can now be compared for order (via `PartialOrd`),
* The `size` crate can now be used in `no_std` mode by compiling with default
  features disabled (see the crate-level documentation for more info),
* All types and methods have been extensively documented in addition to
  extensive crate- and module-level documentation.
Assets 2
Loading