Enum with `Substring` raw value?

When count says:

By "length" it means code-unit length, not the number of characters. Obviously it must visit every code-unit to determine the length of the string, and indeed it scales linearly as your tests show.

It's similar to how, in String.reserveCapacity(Int), the integer parameter is a UTF8 code-unit count rather than character count, even though String's elements are characters.

It may be worth filing a documentation bug to make this clearer.

2 Likes