StringProtocol.UTF8View
only requires Collection
conformance, even though StringProtocol
itself, as well as the UTF16View
and UnicodeScalarView
, are BidirectionalCollections
. The actual UTF8Views for String and Substring are of course bidirectional. It's actually commented out from the protocol definition, which makes me think it may have been an oversight not to un-comment it?
This is just a really weird asymmetry which forces me to write a bunch of additional constraints. Given that StringProtocol
is kind of "sealed", would it be possible to fix this? Or would it break ABI?