This is a very large sweeping API change. Here are the highlights:
Removed support for ICharSequence.
Added wide support for ReadOnlySpan<char> where supported or ReadOnlyMemory<char> where not.
Dropped support for StringBuilder (as a char sequence type).
Dropped direct support for char[], since ReadOnlySpan<char> implicitly converts it.
Removed all code generation for char sequence types.
Removed duplicated business logic in most places. String can be directly converted to ReadOnlySpan<char> or ReadOnlyMemory<char>, so most of the char sequence business logic is in methods that accept these.
Added internal ValueStringBuilder ref struct for building char sequences on the stack or heap while making minimal changes to the business logic.
Added internal OpenStringBuilder class for cases not covered by ValueStringBuilder, such as a class field.
Replaced most usages of StringBuilder with either ValueStringBuilder or OpenStringBuilder.
Changed Normalizer to do the entire operation on the stack in most cases and refactored the API for Span<char> output.
Refactored StringPrep classes (IDNA, UTS46, IDNA2003) so they have a Try... version of each method that outputs an error code rather than throwing exceptions.
Refactored SimpleFormatter to allow input as ReadOnlySpan<char> parameters.
Ported CaseMapImpl functionality from ICU4C so we can eliminate the character iterator used in Java, thus supporting stack allocations using ReadOnlySpan<char>.
Reduced allocations when loading or interacting with UCultureInfo.
Removed FEATURE_SPAN and FEATURE_ARRAYPOOL.
StringBuilder is inadequate for our needs because it doesn't maintain a contiguous array of characters and we need to rapidly switch between writing and reading individual characters and/or codepoints. ValueStringBuilder and OpenStringBuilder were created so we can easily call AsSpan() or AsMemory() to pass the memory location to our business logic without allocating a temporary buffer.
Fixes #56, Fixes #54, Closes #55
This is a very large sweeping API change. Here are the highlights:
ICharSequence
.ReadOnlySpan<char>
where supported orReadOnlyMemory<char>
where not.StringBuilder
(as a char sequence type).char[]
, sinceReadOnlySpan<char>
implicitly converts it.ReadOnlySpan<char>
orReadOnlyMemory<char>
, so most of the char sequence business logic is in methods that accept these.ValueStringBuilder
ref struct for building char sequences on the stack or heap while making minimal changes to the business logic.OpenStringBuilder
class for cases not covered byValueStringBuilder
, such as a class field.StringBuilder
with eitherValueStringBuilder
orOpenStringBuilder
.Span<char>
output.IDNA
,UTS46
,IDNA2003
) so they have a Try... version of each method that outputs an error code rather than throwing exceptions.SimpleFormatter
to allow input asReadOnlySpan<char>
parameters.CaseMapImpl
functionality from ICU4C so we can eliminate the character iterator used in Java, thus supporting stack allocations usingReadOnlySpan<char>
.UCultureInfo
.FEATURE_SPAN
andFEATURE_ARRAYPOOL
.StringBuilder
is inadequate for our needs because it doesn't maintain a contiguous array of characters and we need to rapidly switch between writing and reading individual characters and/or codepoints.ValueStringBuilder
andOpenStringBuilder
were created so we can easily callAsSpan()
orAsMemory()
to pass the memory location to our business logic without allocating a temporary buffer.