nushell/crates/nu_plugin_formats/src
Ian Manske 7f61cbbfd6
Add Filesize type (#14369)
# Description
Adds a new `Filesize` type so that `FromValue` can be used to convert a
`Value::Filesize` to a `Filesize`. Currently, to extract a filesize from
a `Value` using `FromValue`, you have to extract an `i64` which coerces
`Value::Int`, `Value::Duration`, and `Value::Filesize` to an `i64`.

Having a separate type also allows us to enforce checked math to catch
overflows. Similarly, it allows us to specify other trait
implementations like `Display` in a common place.

# User-Facing Changes
Multiplication with filesizes now error on overflow. Should not be a
breaking change for plugins (i.e., serialization) since `Filesize` is
marked with `serde(transparent)`.

# Tests + Formatting
Updated some tests.
2024-11-29 21:24:17 +00:00
..
from Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
to Add Filesize type (#14369) 2024-11-29 21:24:17 +00:00
lib.rs Adding plist support (#13545) 2024-08-05 14:07:15 -07:00
main.rs Adding plist support (#13545) 2024-08-05 14:07:15 -07:00