Skip to content

[FEATURE] write APIs should take buffer: &mut [MaybeUninit<u8>] #92

@reinerp

Description

@reinerp

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>]?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions