fix: Adds ISpanFormattable to Geometry structs (#1231)
* Adds ISpanFormattable to geometry structs and makes ToString() near-zero-allocation. * Adds IEquatable, and Parsable to Rectangle3D to get it in-line with the other structs. Closes #1067
This commit is contained in:
parent
c75bde55da
commit
d7d914df6c
12 changed files with 721 additions and 195 deletions
|
|
@ -113,7 +113,8 @@ public struct Point2D
|
|||
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider)
|
||||
=> destination.TryWrite(provider, $"({m_X}, {m_Y})", out charsWritten);
|
||||
|
||||
public override string ToString() {
|
||||
public override string ToString()
|
||||
{
|
||||
// Maximum number of characters that are needed to represent this:
|
||||
// 4 characters for (, )
|
||||
// Up to 11 characters to represent each integer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue