3 ms·
The reason to encode it in the type system is it allows for optimization. Option<NonZeroI8> uses a single byte because it knows 0 is available to represent the
by ziml77 2y ago
The reason to encode it in the type system is it allows for optimization. Option<NonZeroI8> uses a single byte because it knows 0 is available to represent the None state. Option<BalancedI8> could do the same thing with -128 representing None.