| ... | @@ -950,13 +950,13 @@ fn formatSizeImpl(comptime base: comptime_int) type { | ... | @@ -950,13 +950,13 @@ fn formatSizeImpl(comptime base: comptime_int) type { |
| 950 | } | 950 | } |
| 951 | }; | 951 | }; |
| 952 | } | 952 | } |
| 953 | | | |
| 954 | const formatSizeDec = formatSizeImpl(1000).formatSizeImpl; | 953 | const formatSizeDec = formatSizeImpl(1000).formatSizeImpl; |
| 955 | const formatSizeBin = formatSizeImpl(1024).formatSizeImpl; | 954 | const formatSizeBin = formatSizeImpl(1024).formatSizeImpl; |
| 956 | | 955 | |
| 957 | /// Return a Formatter for a u64 value representing a file size. | 956 | /// Return a Formatter for a u64 value representing a file size. |
| 958 | /// This formatter represents the number as multiple of 1000 and uses the SI | 957 | /// This formatter represents the number as multiple of 1000 and uses the SI |
| 959 | /// measurement units (kB, MB, GB, ...). | 958 | /// measurement units (kB, MB, GB, ...). |
| | 959 | /// Format option `precision` is ignored when `value` is less than 1kB |
| 960 | pub fn fmtIntSizeDec(value: u64) std.fmt.Formatter(formatSizeDec) { | 960 | pub fn fmtIntSizeDec(value: u64) std.fmt.Formatter(formatSizeDec) { |
| 961 | return .{ .data = value }; | 961 | return .{ .data = value }; |
| 962 | } | 962 | } |
| ... | @@ -964,6 +964,7 @@ pub fn fmtIntSizeDec(value: u64) std.fmt.Formatter(formatSizeDec) { | ... | @@ -964,6 +964,7 @@ pub fn fmtIntSizeDec(value: u64) std.fmt.Formatter(formatSizeDec) { |
| 964 | /// Return a Formatter for a u64 value representing a file size. | 964 | /// Return a Formatter for a u64 value representing a file size. |
| 965 | /// This formatter represents the number as multiple of 1024 and uses the IEC | 965 | /// This formatter represents the number as multiple of 1024 and uses the IEC |
| 966 | /// measurement units (KiB, MiB, GiB, ...). | 966 | /// measurement units (KiB, MiB, GiB, ...). |
| | 967 | /// Format option `precision` is ignored when `value` is less than 1KiB |
| 967 | pub fn fmtIntSizeBin(value: u64) std.fmt.Formatter(formatSizeBin) { | 968 | pub fn fmtIntSizeBin(value: u64) std.fmt.Formatter(formatSizeBin) { |
| 968 | return .{ .data = value }; | 969 | return .{ .data = value }; |
| 969 | } | 970 | } |