mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.fmt.fmtIntSize*: document when precision is ignored
This commit is contained in:
parent
13da34955c
commit
a670f55195
1 changed files with 2 additions and 1 deletions
|
|
@ -950,13 +950,13 @@ fn formatSizeImpl(comptime base: comptime_int) type {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatSizeDec = formatSizeImpl(1000).formatSizeImpl;
|
const formatSizeDec = formatSizeImpl(1000).formatSizeImpl;
|
||||||
const formatSizeBin = formatSizeImpl(1024).formatSizeImpl;
|
const formatSizeBin = formatSizeImpl(1024).formatSizeImpl;
|
||||||
|
|
||||||
/// Return a Formatter for a u64 value representing a file size.
|
/// Return a Formatter for a u64 value representing a file size.
|
||||||
/// This formatter represents the number as multiple of 1000 and uses the SI
|
/// This formatter represents the number as multiple of 1000 and uses the SI
|
||||||
/// measurement units (kB, MB, GB, ...).
|
/// measurement units (kB, MB, GB, ...).
|
||||||
|
/// Format option `precision` is ignored when `value` is less than 1kB
|
||||||
pub fn fmtIntSizeDec(value: u64) std.fmt.Formatter(formatSizeDec) {
|
pub fn fmtIntSizeDec(value: u64) std.fmt.Formatter(formatSizeDec) {
|
||||||
return .{ .data = value };
|
return .{ .data = value };
|
||||||
}
|
}
|
||||||
|
|
@ -964,6 +964,7 @@ pub fn fmtIntSizeDec(value: u64) std.fmt.Formatter(formatSizeDec) {
|
||||||
/// Return a Formatter for a u64 value representing a file size.
|
/// Return a Formatter for a u64 value representing a file size.
|
||||||
/// This formatter represents the number as multiple of 1024 and uses the IEC
|
/// This formatter represents the number as multiple of 1024 and uses the IEC
|
||||||
/// measurement units (KiB, MiB, GiB, ...).
|
/// measurement units (KiB, MiB, GiB, ...).
|
||||||
|
/// Format option `precision` is ignored when `value` is less than 1KiB
|
||||||
pub fn fmtIntSizeBin(value: u64) std.fmt.Formatter(formatSizeBin) {
|
pub fn fmtIntSizeBin(value: u64) std.fmt.Formatter(formatSizeBin) {
|
||||||
return .{ .data = value };
|
return .{ .data = value };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue