Problem
In the ToLexical APIs, they take the destination buffer as type &mut [u8]. According to Rust's soundness rules, this requires the buffer to be initialized before calling to_lexical or to_lexical_unchecked, even though both of those functions only write to the buffer. I'd like to use ToLexical on uninitialized buffers (such as Vec::spare_capacity_mut).
Solution
Can we have a variant of the ToLexical APIs to take the destination buffer as type &mut [MaybeUninit<u8>]?
Problem
In the
ToLexicalAPIs, they take the destination buffer as type&mut [u8]. According to Rust's soundness rules, this requires the buffer to be initialized before callingto_lexicalorto_lexical_unchecked, even though both of those functions only write to the buffer. I'd like to useToLexicalon uninitialized buffers (such asVec::spare_capacity_mut).Solution
Can we have a variant of the
ToLexicalAPIs to take the destination buffer as type&mut [MaybeUninit<u8>]?