We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
By default the Display implementation is using SI units (e.g. KB), which looks weird when printing those:
Display
--http-server-request-limit <http-server-request-limit> The overall request limit [env: HTTP_SERVER_REQUEST_LIMIT=] [default: "262.1 KB"] --http-server-json-limit <http-server-json-limit> The JSON request limit [env: HTTP_SERVER_JSON_LIMIT=] [default: "2.1 MB"]
It would be great if there would be a newtype for defaulting to "binary format" (powers of 2, e.g. KiB).
KiB
The text was updated successfully, but these errors were encountered:
For example:
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Ord, Hash, Default)] pub struct BinaryByteSize(pub ByteSize); impl Deref for BinaryByteSize { type Target = ByteSize; fn deref(&self) -> &Self::Target { &self.0 } } impl DerefMut for BinaryByteSize { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } impl Display for BinaryByteSize { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.write_str(&self.0.to_string_as(true)) } } impl FromStr for BinaryByteSize { type Err = <ByteSize as FromStr>::Err; fn from_str(s: &str) -> Result<Self, Self::Err> { ByteSize::from_str(s).map(BinaryByteSize) } }
Turns this into:
--http-server-request-limit <http-server-request-limit> The overall request limit [env: HTTP_SERVER_REQUEST_LIMIT=] [default: "256.0 kiB"] --http-server-json-limit <http-server-json-limit> The JSON request limit [env: HTTP_SERVER_JSON_LIMIT=] [default: "2.0 MiB"]
Sorry, something went wrong.
Planned with 2.0. 🫡
MrCroxx
Successfully merging a pull request may close this issue.
By default the
Display
implementation is using SI units (e.g. KB), which looks weird when printing those:It would be great if there would be a newtype for defaulting to "binary format" (powers of 2, e.g.
KiB
).The text was updated successfully, but these errors were encountered: