Open Neme12 opened 1 year ago
Tagging subscribers to this area: @dotnet/area-system-runtime See info in area-owners.md if you want to be subscribed.
Author: | Neme12 |
---|---|
Assignees: | - |
Labels: | `api-suggestion`, `area-System.Runtime`, `untriaged` |
Milestone: | - |
CC. @GrabYourPitchforks for input
I renamed the properties to MaxUtf16SequenceLength
and MaxUtf8SequenceLength
to match the existing properties of Utf16SequenceLength
and Utf8SequenceLength
.
CC. @GrabYourPitchforks Levi Broderick FTE for input
I have no arguments against it. The values are stable. If there's a use case for it, expose it.
The use case is whenever I'm calling EncodeToUtf16
(or EncodeToUtf8
) on a single Rune
into a temporary buffer that I have to allocate with the necessary size.
Background and motivation
Currently,
Rune
has internal constants ofMaxUtf16CharsPerRune
andMaxUtf8BytesPerRune
. I think it would make sense to make them public as they are really useful when calling theEncodeToUtf16
andEncodeToUtf8
methods so that you can create a buffer of the appropriate size. Currently, you have to hard-code the values 2 and 4 for that as magic constants, which feels meh.API Proposal
API Usage
Alternative Designs
No response
Risks
No response