1// This file is port from https://github.com/bytesize-rs/bytesize/blob/7467a23df30bc1fee48326e0fa6c063fc85676a2/src/lib.rs
2// Copyright Apache-2.0 January 2004 The bytesize Authors. All rights reserved.
3
4///| `ByteSize` is a semantic wrapper for byte count representations.
5
6///| Number of bytes in 1 kilobyte.
7pub const UInt64
Number of bytes in 1 kilobyte.
KB : UInt64
UInt64 = 1_000
8
9///| Number of bytes in 1 megabyte.
10pub const UInt64
Number of bytes in 1 megabyte.
MB : UInt64
UInt64 = 1_000_000
11
12///| Number of bytes in 1 gigabyte.
13pub const UInt64
Number of bytes in 1 gigabyte.
GB : UInt64
UInt64 = 1_000_000_000
14
15///| Number of bytes in 1 terabyte.
16pub const UInt64
Number of bytes in 1 terabyte.
TB : UInt64
UInt64 = 1_000_000_000_000
17
18///| Number of bytes in 1 petabyte.
19pub const UInt64
Number of bytes in 1 petabyte.
PB : UInt64
UInt64 = 1_000_000_000_000_000
20
21///| Number of bytes in 1 kibibyte.
22pub const UInt64
Number of bytes in 1 kibibyte.
KIB : UInt64
UInt64 = 1_024
23
24///| Number of bytes in 1 mebibyte.
25pub const UInt64
Number of bytes in 1 mebibyte.
MIB : UInt64
UInt64 = 1_048_576
26
27///| Number of bytes in 1 gibibyte.
28pub const UInt64
Number of bytes in 1 gibibyte.
GIB : UInt64
UInt64 = 1_073_741_824
29
30///| Number of bytes in 1 tebibyte.
31pub const UInt64
Number of bytes in 1 tebibyte.
TIB : UInt64
UInt64 = 1_099_511_627_776
32
33///| Number of bytes in 1 pebibyte.
34pub const UInt64
Number of bytes in 1 pebibyte.
PIB : UInt64
UInt64 = 1_125_899_906_842_624
35
36///| IEC (binary) units.
37///
38/// See <https://en.wikipedia.org/wiki/Kilobyte>.
39const UNITS_IEC : String
String = "KMGTPE"
40
41///| SI (decimal) units.
42///
43/// See <https://en.wikipedia.org/wiki/Kilobyte>.
44const UNITS_SI : String
String = "kMGTPE"
45
46///| `ln(1024) ~= 6.931`
47const Double
ln(1024) ~= 6.931
LN_KIB : Double
Double = 6.931_471_805_599_453
48
49///| `ln(1000) ~= 6.908`
50const Double
ln(1000) ~= 6.908
LN_KB : Double
Double = 6.907_755_278_982_137
51
52///| Converts a quantity of kilobytes to bytes.
53pub fn (size : UInt64) -> UInt64
Converts a quantity of kilobytes to bytes.
kb(UInt64
size : UInt64
UInt64) -> UInt64
UInt64 {
54  UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 kilobyte.
KB
55}
56
57///| Converts a quantity of kibibytes to bytes.
58pub fn (size : UInt64) -> UInt64
Converts a quantity of kibibytes to bytes.
kib(UInt64
size : UInt64
UInt64) -> UInt64
UInt64 {
59  UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 kibibyte.
KIB
60}
61
62///| Converts a quantity of megabytes to bytes.
63pub fn (size : UInt64) -> UInt64
Converts a quantity of megabytes to bytes.
mb(UInt64
size : UInt64
UInt64) -> UInt64
UInt64 {
64  UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 megabyte.
MB
65}
66
67///| Converts a quantity of mebibytes to bytes.
68pub fn (size : UInt64) -> UInt64
Converts a quantity of mebibytes to bytes.
mib(UInt64
size : UInt64
UInt64) -> UInt64
UInt64 {
69  UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 mebibyte.
MIB
70}
71
72///| Converts a quantity of gigabytes to bytes.
73pub fn (size : UInt64) -> UInt64
Converts a quantity of gigabytes to bytes.
gb(UInt64
size : UInt64
UInt64) -> UInt64
UInt64 {
74  UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 gigabyte.
GB
75}
76
77///| Converts a quantity of gibibytes to bytes.
78pub fn (size : UInt64) -> UInt64
Converts a quantity of gibibytes to bytes.
gib(UInt64
size : UInt64
UInt64) -> UInt64
UInt64 {
79  UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 gibibyte.
GIB
80}
81
82///| Converts a quantity of terabytes to bytes.
83pub fn (size : UInt64) -> UInt64
Converts a quantity of terabytes to bytes.
tb(UInt64
size : UInt64
UInt64) -> UInt64
UInt64 {
84  UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 terabyte.
TB
85}
86
87///| Converts a quantity of tebibytes to bytes.
88pub fn (size : UInt64) -> UInt64
Converts a quantity of tebibytes to bytes.
tib(UInt64
size : UInt64
UInt64) -> UInt64
UInt64 {
89  UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 tebibyte.
TIB
90}
91
92///| Converts a quantity of petabytes to bytes.
93pub fn (size : UInt64) -> UInt64
Converts a quantity of petabytes to bytes.
pb(UInt64
size : UInt64
UInt64) -> UInt64
UInt64 {
94  UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 petabyte.
PB
95}
96
97///| Converts a quantity of pebibytes to bytes.
98pub fn (size : UInt64) -> UInt64
Converts a quantity of pebibytes to bytes.
pib(UInt64
size : UInt64
UInt64) -> UInt64
UInt64 {
99  UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 pebibyte.
PIB
100}
101
102///| Byte size representation.
103pub struct ByteSize {
104  UInt64
size : UInt64
UInt64
105} derive(trait Show {
  output(Self, &Logger) -> Unit
  to_string(Self) -> String
}
Trait for types that can be converted to String
Show, trait Eq {
  op_equal(Self, Self) -> Bool
}
Trait for types whose elements can test for equality
Eq, trait Compare {
  compare(Self, Self) -> Int
}
Trait for types whose elements are ordered
The return value of [compare] is:
- zero, if the two arguments are equal
- negative, if the first argument is smaller
- positive, if the first argument is greater
Compare,trait Hash {
  hash_combine(Self, Hasher) -> Unit
  hash(Self) -> Int
}
Trait for types that can be hashed
Hash, trait Default {
  default() -> Self
}
Trait for types with a default value
Default)
106
107///| Constructs a byte size wrapper from a quantity of bytes.
108pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
109  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size, }
110}
111
112///| Constructs a byte size wrapper from a quantity of kilobytes.
113/// 
114/// ## example
115/// ```moonbit
116/// let size = ByteSize::kb(1)
117/// assert_eq(size.as_u64(), 1000UL)
118/// assert_true(@bytesize.ByteSize::kib(4) > @bytesize.ByteSize::kb(4))
119/// ```
120pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kilobytes.
example
let size = ByteSize::kb(1)
assert_eq(size.as_u64(), 1000UL)
assert_true(@bytesize.ByteSize::kib(4) > @bytesize.ByteSize::kb(4))
kb(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
121  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 kilobyte.
KB }
122}
123
124///| Constructs a byte size wrapper from a quantity of kibibytes.
125pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kibibytes.
kib(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
126  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 kibibyte.
KIB }
127}
128
129///| Constructs a byte size wrapper from a quantity of megabytes.
130pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of megabytes.
mb(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
131  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 megabyte.
MB }
132}
133
134///| Constructs a byte size wrapper from a quantity of mebibytes.
135pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of mebibytes.
mib(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
136  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 mebibyte.
MIB }
137}
138
139///| Constructs a byte size wrapper from a quantity of gigabytes.
140pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of gigabytes.
gb(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
141  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 gigabyte.
GB }
142}
143
144///| Constructs a byte size wrapper from a quantity of gibibytes.
145pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of gibibytes.
gib(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
146  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 gibibyte.
GIB }
147}
148
149///| Constructs a byte size wrapper from a quantity of terabytes.
150pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of terabytes.
tb(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
151  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 terabyte.
TB }
152}
153
154///| Constructs a byte size wrapper from a quantity of tebibytes.
155pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of tebibytes.
tib(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
156  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 tebibyte.
TIB }
157}
158
159///| Constructs a byte size wrapper from a quantity of petabytes.
160pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of petabytes.
pb(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
161  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 petabyte.
PB }
162}
163
164///| Constructs a byte size wrapper from a quantity of pebibytes.
165pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of pebibytes.
pib(UInt64
size : UInt64
UInt64) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
166  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* UInt64
Number of bytes in 1 pebibyte.
PIB }
167}
168
169///| Returns byte count.
170pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(self : ByteSize) -> UInt64
Returns byte count.
as_u64(ByteSize
self : struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize) -> UInt64
UInt64 {
171  ByteSize
self.UInt64
size
172}
173
174///| Returns a formatting display wrapper.
175pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(self : ByteSize) -> Display
Returns a formatting display wrapper.
display(ByteSize
self : struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize) -> struct Display {
  byte_size: UInt64
  format: Format
}
Formatting display wrapper for byte sizes.
Supports various styles. By default, the IEC style is used.
Display {
176  struct Display {
  byte_size: UInt64
  format: Format
}
Formatting display wrapper for byte sizes.
Supports various styles. By default, the IEC style is used.
Display::(byte_size : UInt64) -> Display
Create a new Display with the given byte size and default IEC format.
new(ByteSize
self.UInt64
size)
177}
178
179///| Convert ByteSize to string using default IEC format.
180pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(self : ByteSize) -> String
Convert ByteSize to string using default IEC format.
to_string(ByteSize
self : struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize) -> String
String {
181  ByteSize
self.(self : ByteSize) -> Display
Returns a formatting display wrapper.
display().(self : Display, precision~ : Int = ..) -> String
Convert Display to string representation.
example
assert_eq("518 GiB", @bytesize.ByteSize::gib(518).display().iec().to_string())
assert_eq("556.2 GB", @bytesize.ByteSize::gib(518).display().si().to_string())
assert_eq("518G", @bytesize.ByteSize::gib(518).display().iec_short().to_string())
to_string()
182}
183
184///| Debug representation showing both formatted size and raw bytes.
185pub fn struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(self : ByteSize) -> String
Debug representation showing both formatted size and raw bytes.
debug_string(ByteSize
self : struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize) -> String
String {
186  "\{ByteSize
self.(self : ByteSize) -> String
Convert ByteSize to string using default IEC format.
to_string()} (\{ByteSize
self.UInt64
size} bytes)"
187}
188
189///| Addition: ByteSize + ByteSize = ByteSize
190impl trait Add {
  op_add(Self, Self) -> Self
}
types implementing this trait can use the + operator
Add for struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize with (self : ByteSize, rhs : ByteSize) -> ByteSize
Addition: ByteSize + ByteSize = ByteSize
op_add(ByteSize
self, ByteSize
rhs : struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
191  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: ByteSize
rhs.UInt64
size (self : UInt64, other : UInt64) -> UInt64
Adds two 64-bit unsigned integers. This is the implementation of the +
operator for UInt64.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the sum of the two unsigned 64-bit integers. If the result overflows,
it wraps around modulo 2^64.
Example:
  let a = 42UL
  let b = 100UL
  inspect(a + b, content="142")
  // Demonstrate overflow behavior
  let max = 18446744073709551615UL
  inspect(max + 1UL, content="0")
+ ByteSize
self.UInt64
size }
192}
193
194///| Subtraction: ByteSize - ByteSize = ByteSize
195impl trait Sub {
  op_sub(Self, Self) -> Self
}
types implementing this trait can use the - operator
Sub for struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize with (self : ByteSize, rhs : ByteSize) -> ByteSize
Subtraction: ByteSize - ByteSize = ByteSize
op_sub(ByteSize
self, ByteSize
rhs : struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
196  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: ByteSize
self.UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs subtraction between two unsigned 64-bit integers. When the result
would be negative, the function wraps around using modular arithmetic (2^64).
Parameters:
- self: The first unsigned 64-bit integer (minuend).
- other: The second unsigned 64-bit integer to subtract from the first
(subtrahend).
Returns the difference between the two numbers, wrapped around if necessary.
Example:
  let a = 5UL
  let b = 3UL
  inspect(a - b, content="2")
  let c = 3UL
  let d = 5UL
  inspect(c - d, content="18446744073709551614") // wraps around to 2^64 - 2
- ByteSize
rhs.UInt64
size }
197}
198
199///| Multiplication: ByteSize * ByteSize = ByteSize
200impl trait Mul {
  op_mul(Self, Self) -> Self
}
types implementing this trait can use the * operator
Mul for struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize with (self : ByteSize, rhs : ByteSize) -> ByteSize
Multiplication: ByteSize * ByteSize = ByteSize
op_mul(ByteSize
self, ByteSize
rhs : struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize) -> struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize {
201  struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: ByteSize
rhs.UInt64
size (self : UInt64, other : UInt64) -> UInt64
Performs multiplication between two unsigned 64-bit integers.
Parameters:
- self: The first unsigned 64-bit integer operand.
- other: The second unsigned 64-bit integer operand.
Returns the product of the two unsigned 64-bit integers. The result wraps
around if it exceeds the maximum value of UInt64.
Example:
  let a = 2UL
  let b = 3UL
  inspect(a * b, content="6")
  // Demonstrate wrapping behavior
  let max = 18446744073709551615UL
  inspect(max * 2UL, content="18446744073709551614") // Wraps around to max - 1
* ByteSize
self.UInt64
size }
202}
203
204///|
205test "test_arithmetic_op" {
206  let ByteSize
x = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of megabytes.
mb(1)
207  let ByteSize
y = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kilobytes.
example
let size = ByteSize::kb(1)
assert_eq(size.as_u64(), 1000UL)
assert_true(@bytesize.ByteSize::kib(4) > @bytesize.ByteSize::kb(4))
kb(100)
208  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
x (self : ByteSize, rhs : ByteSize) -> ByteSize
Addition: ByteSize + ByteSize = ByteSize
+ ByteSize
y).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 1_100_000UL)
209  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
x (self : ByteSize, rhs : ByteSize) -> ByteSize
Subtraction: ByteSize - ByteSize = ByteSize
- ByteSize
y).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 900_000UL)
210  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
x (self : ByteSize, rhs : ByteSize) -> ByteSize
Addition: ByteSize + ByteSize = ByteSize
+ struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(100_000UL)).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 1_100_000UL)
211  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
x (self : ByteSize, rhs : ByteSize) -> ByteSize
Multiplication: ByteSize * ByteSize = ByteSize
* struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(2UL)).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 2_000_000UL)
212
213  // Test commutative operations
214  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(2UL) (self : ByteSize, rhs : ByteSize) -> ByteSize
Multiplication: ByteSize * ByteSize = ByteSize
* ByteSize
x).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 2_000_000UL)
215  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(100_000UL) (self : ByteSize, rhs : ByteSize) -> ByteSize
Addition: ByteSize + ByteSize = ByteSize
+ ByteSize
x).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 1_100_000UL)
216}
217
218///|
219test "test_arithmetic_primitives" {
220  let ByteSize
x = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of megabytes.
mb(1)
221  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
x (self : ByteSize, rhs : ByteSize) -> ByteSize
Addition: ByteSize + ByteSize = ByteSize
+ struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(1_000_000)).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 2_000_000UL)
222  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
x (self : ByteSize, rhs : ByteSize) -> ByteSize
Addition: ByteSize + ByteSize = ByteSize
+ struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(1_000)).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 1_001_000UL)
223  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
x (self : ByteSize, rhs : ByteSize) -> ByteSize
Subtraction: ByteSize - ByteSize = ByteSize
- struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(1_000_000)).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 0UL)
224  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
x (self : ByteSize, rhs : ByteSize) -> ByteSize
Subtraction: ByteSize - ByteSize = ByteSize
- struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(1_000)).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 999_000UL)
225
226  // Test with different integer types
227  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
x (self : ByteSize, rhs : ByteSize) -> ByteSize
Addition: ByteSize + ByteSize = ByteSize
+ struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(1000000)).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 2_000_000UL)
228  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
x (self : ByteSize, rhs : ByteSize) -> ByteSize
Addition: ByteSize + ByteSize = ByteSize
+ struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(1000)).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 1_001_000UL)
229}
230
231///|
232test "test_comparison" {
233  (x : Bool, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that the given boolean value is true. Throws an error with source
location information if the assertion fails.
Parameters:
- condition: The boolean value to be checked.
- location: The source location where the assertion is made. Defaults to
the current location.
Throws a Failure error with a descriptive message including the source
location if the condition is false.
Example:
  assert_true(true)
assert_true(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of megabytes.
mb(1) (ByteSize, ByteSize) -> Bool
automatically derived
== struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kilobytes.
example
let size = ByteSize::kb(1)
assert_eq(size.as_u64(), 1000UL)
assert_true(@bytesize.ByteSize::kib(4) > @bytesize.ByteSize::kb(4))
kb(1000))
234  (x : Bool, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that the given boolean value is true. Throws an error with source
location information if the assertion fails.
Parameters:
- condition: The boolean value to be checked.
- location: The source location where the assertion is made. Defaults to
the current location.
Throws a Failure error with a descriptive message including the source
location if the condition is false.
Example:
  assert_true(true)
assert_true(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of mebibytes.
mib(1) (ByteSize, ByteSize) -> Bool
automatically derived
== struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kibibytes.
kib(1024))
235  (x : Bool, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that the given boolean value is true. Throws an error with source
location information if the assertion fails.
Parameters:
- condition: The boolean value to be checked.
- location: The source location where the assertion is made. Defaults to
the current location.
Throws a Failure error with a descriptive message including the source
location if the condition is false.
Example:
  assert_true(true)
assert_true(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of megabytes.
mb(1) (x : ByteSize, y : ByteSize) -> Bool
!= struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kibibytes.
kib(1024))
236  (x : Bool, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that the given boolean value is true. Throws an error with source
location information if the assertion fails.
Parameters:
- condition: The boolean value to be checked.
- location: The source location where the assertion is made. Defaults to
the current location.
Throws a Failure error with a descriptive message including the source
location if the condition is false.
Example:
  assert_true(true)
assert_true(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of megabytes.
mb(1) (self_ : ByteSize, other : ByteSize) -> Bool
< struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kibibytes.
kib(1024))
237  (x : Bool, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that the given boolean value is true. Throws an error with source
location information if the assertion fails.
Parameters:
- condition: The boolean value to be checked.
- location: The source location where the assertion is made. Defaults to
the current location.
Throws a Failure error with a descriptive message including the source
location if the condition is false.
Example:
  assert_true(true)
assert_true(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(0) (self_ : ByteSize, other : ByteSize) -> Bool
< struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of tebibytes.
tib(1))
238}
239
240///|
241test "test_display" {
242  (a : String, b : String, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq("215 B", struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(215).(self : ByteSize) -> String
Convert ByteSize to string using default IEC format.
to_string())
243  (a : String, b : String, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq("1 KiB", struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kibibytes.
kib(1).(self : ByteSize) -> String
Convert ByteSize to string using default IEC format.
to_string())
244  (a : String, b : String, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq("301 KiB", struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kibibytes.
kib(301).(self : ByteSize) -> String
Convert ByteSize to string using default IEC format.
to_string())
245  (a : String, b : String, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq("419 MiB", struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of mebibytes.
mib(419).(self : ByteSize) -> String
Convert ByteSize to string using default IEC format.
to_string())
246  (a : String, b : String, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq("518 GiB", struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of gibibytes.
gib(518).(self : ByteSize) -> String
Convert ByteSize to string using default IEC format.
to_string())
247  (a : String, b : String, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq("815 TiB", struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of tebibytes.
tib(815).(self : ByteSize) -> String
Convert ByteSize to string using default IEC format.
to_string())
248  (a : String, b : String, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq("609 PiB", struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of pebibytes.
pib(609).(self : ByteSize) -> String
Convert ByteSize to string using default IEC format.
to_string())
249}
250
251///|
252test "test_display_formats" {
253  let ByteSize
size = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of megabytes.
mb(1)
254
255  // Test different format styles
256  (a : String, b : String, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(ByteSize
size.(self : ByteSize) -> Display
Returns a formatting display wrapper.
display().(self : Display) -> Display
Format using SI (decimal) units.
E.g., 12.3 MB.
si().(self : Display, precision~ : Int = ..) -> String
Convert Display to string representation.
example
assert_eq("518 GiB", @bytesize.ByteSize::gib(518).display().iec().to_string())
assert_eq("556.2 GB", @bytesize.ByteSize::gib(518).display().si().to_string())
assert_eq("518G", @bytesize.ByteSize::gib(518).display().iec_short().to_string())
to_string(), "1 MB")
257  (a : String, b : String, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(ByteSize
size.(self : ByteSize) -> Display
Returns a formatting display wrapper.
display().(self : Display) -> Display
Format using a short style and SI (decimal) units.
E.g., 12.3M.
si_short().(self : Display, precision~ : Int = ..) -> String
Convert Display to string representation.
example
assert_eq("518 GiB", @bytesize.ByteSize::gib(518).display().iec().to_string())
assert_eq("556.2 GB", @bytesize.ByteSize::gib(518).display().si().to_string())
assert_eq("518G", @bytesize.ByteSize::gib(518).display().iec_short().to_string())
to_string(), "1M")
258}
259
260///|
261test "test_default" {
262  let ByteSize
default_size = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::{ UInt64
size: 0UL }
263  (a : ByteSize, b : ByteSize, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(0), ByteSize
default_size)
264}
265
266///|
267test "test_constructor_consistency" {
268  // Test that constructors work correctly
269  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kilobytes.
example
let size = ByteSize::kb(1)
assert_eq(size.as_u64(), 1000UL)
assert_true(@bytesize.ByteSize::kib(4) > @bytesize.ByteSize::kb(4))
kb(1).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), UInt64
Number of bytes in 1 kilobyte.
KB)
270  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kibibytes.
kib(1).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), UInt64
Number of bytes in 1 kibibyte.
KIB)
271  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of megabytes.
mb(1).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), UInt64
Number of bytes in 1 megabyte.
MB)
272  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of mebibytes.
mib(1).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), UInt64
Number of bytes in 1 mebibyte.
MIB)
273  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of gigabytes.
gb(1).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), UInt64
Number of bytes in 1 gigabyte.
GB)
274  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of gibibytes.
gib(1).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), UInt64
Number of bytes in 1 gibibyte.
GIB)
275  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of terabytes.
tb(1).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), UInt64
Number of bytes in 1 terabyte.
TB)
276  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of tebibytes.
tib(1).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), UInt64
Number of bytes in 1 tebibyte.
TIB)
277  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of petabytes.
pb(1).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), UInt64
Number of bytes in 1 petabyte.
PB)
278  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of pebibytes.
pib(1).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), UInt64
Number of bytes in 1 pebibyte.
PIB)
279}
280
281///|
282test "test_large_values" {
283  let ByteSize
large_size = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of terabytes.
tb(5)
284  let ByteSize
another_large = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of petabytes.
pb(1)
285  (x : Bool, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that the given boolean value is true. Throws an error with source
location information if the assertion fails.
Parameters:
- condition: The boolean value to be checked.
- location: The source location where the assertion is made. Defaults to
the current location.
Throws a Failure error with a descriptive message including the source
location if the condition is false.
Example:
  assert_true(true)
assert_true(ByteSize
large_size (self_ : ByteSize, other : ByteSize) -> Bool
< ByteSize
another_large)
286  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
large_size (self : ByteSize, rhs : ByteSize) -> ByteSize
Addition: ByteSize + ByteSize = ByteSize
+ struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of gigabytes.
gb(500)).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 5_500_000_000_000UL)
287}
288
289///|
290test "test_zero_and_small_values" {
291  let ByteSize
zero = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(0)
292  let ByteSize
one_byte = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(1)
293  let ByteSize
small = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(512)
294  (x : Bool, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that the given boolean value is true. Throws an error with source
location information if the assertion fails.
Parameters:
- condition: The boolean value to be checked.
- location: The source location where the assertion is made. Defaults to
the current location.
Throws a Failure error with a descriptive message including the source
location if the condition is false.
Example:
  assert_true(true)
assert_true(ByteSize
zero (self_ : ByteSize, other : ByteSize) -> Bool
< ByteSize
one_byte)
295  (x : Bool, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that the given boolean value is true. Throws an error with source
location information if the assertion fails.
Parameters:
- condition: The boolean value to be checked.
- location: The source location where the assertion is made. Defaults to
the current location.
Throws a Failure error with a descriptive message including the source
location if the condition is false.
Example:
  assert_true(true)
assert_true(ByteSize
one_byte (self_ : ByteSize, other : ByteSize) -> Bool
< ByteSize
small)
296  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
small (self : ByteSize, rhs : ByteSize) -> ByteSize
Addition: ByteSize + ByteSize = ByteSize
+ ByteSize
one_byte).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 513UL)
297  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq((ByteSize
small (self : ByteSize, rhs : ByteSize) -> ByteSize
Subtraction: ByteSize - ByteSize = ByteSize
- ByteSize
one_byte).(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 511UL)
298}
299
300///|
301test "test_edge_cases" {
302  // Test edge cases and boundary conditions
303  let ByteSize
max_kb = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(1023)
304  let ByteSize
min_kib = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of kibibytes.
kib(1)
305
306  // 1023 KB should be less than 1 KiB
307  (x : Bool, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that the given boolean value is true. Throws an error with source
location information if the assertion fails.
Parameters:
- condition: The boolean value to be checked.
- location: The source location where the assertion is made. Defaults to
the current location.
Throws a Failure error with a descriptive message including the source
location if the condition is false.
Example:
  assert_true(true)
assert_true(ByteSize
max_kb (self_ : ByteSize, other : ByteSize) -> Bool
< ByteSize
min_kib)
308
309  // Test multiplication doesn't overflow with reasonable values
310  let ByteSize
result = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of megabytes.
mb(1000) (self : ByteSize, rhs : ByteSize) -> ByteSize
Multiplication: ByteSize * ByteSize = ByteSize
* struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(2UL)
311  (a : UInt64, b : UInt64, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(ByteSize
result.(self : ByteSize) -> UInt64
Returns byte count.
as_u64(), 2_000_000_000UL)
312}
313
314///|
315test "test_default" {
316  let ByteSize
default_size = struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::() -> ByteSize
automatically derived
default()
317  (a : ByteSize, b : ByteSize, loc~ : SourceLoc = _) -> Unit raise Error
Asserts that two values are equal. If they are not equal, raises a failure
with a message containing the source location and the values being compared.
Parameters:
- a: First value to compare.
- b: Second value to compare.
- loc: Source location information to include in failure messages. This is
usually automatically provided by the compiler.
Throws a Failure error if the values are not equal, with a message showing
the location of the failing assertion and the actual values that were
compared.
Example:
  assert_eq(1, 1)
  assert_eq("hello", "hello")
assert_eq(ByteSize
default_size, struct ByteSize {
  size: UInt64
}
Byte size representation.
ByteSize::(size : UInt64) -> ByteSize
Constructs a byte size wrapper from a quantity of bytes.
b(0))
318}
319