pub struct TrimSet { /* private fields */ }Expand description
The characters a trim takes off, in the form the loop wants them.
The set is written once in a statement and asked about once a character, so it is worth preparing. The plain characters become a bitmask, one bit each, which is the whole test for the sets almost every statement writes: a space, or a handful of punctuation. Any character past ASCII is kept as the bytes it is written as, and matching is then a comparison of bytes rather than a decode.
Bytes are enough because of what UTF-8 is. A byte below 128 is always a whole character and never part of a longer one, and the encoding of a character is never the front or the back of another character’s encoding, so a match on bytes is a match on characters and no member of the set can be found halfway through something else.