You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a method to convert a vector of Ascii to a string slice without copying #6120
The problem is that that's not generally possible without reqiring that the Ascii vector is one random byte longer than the slice you want. A str slice is one hidden byte longer than a vec slice.
One way to solve this would be to turn ~[Ascii] into an own type AsciiStr, which holds the invariant that its always null terminated. Or we could just say that a [Ascii] may be optionally null terminated, that a trailing null is never considerd part of the string it represents, and that certain operations reqire it.
@erickt was experimenting with removing the null-terminator on ~strs, which would make this possible. (Preferably by implementing the std::str::Str trait.)
As it says.