[Feature Request] starts_with and ends_with on OsStr

There was an idea in this issue to implement starts_with and ends_with on OsStr. I don't see it documented what promises that OsStr has. It seems like it can support any arbitrary byte sequence. One concern is that starts_with won't know where one character ends and another begins. But if OsStr can be constructed with arbitrary byte sequences, is it any more dangerous to allow it to be matched with another OsStr (arbitrary byte sequence)?

I'm willing to implemented this if this idea is acceptable.

1 Like

RFC 2295 is an accepted-but-not-implemented RFC for extending the Pattern API to OsStr.

As an alternative, there is RFC 95290 about locking down the OsStr format so that future RFCs can explore APIs for converting between OsStr and bytes.

1 Like