Table of Contents

Struct String64

Namespace
Typhon.Schema.Definition
Assembly
Typhon.Schema.Definition.dll

A fixed 64-byte inline UTF-8 string buffer — a blittable, fixed-size component field that stores up to 63 bytes plus a null terminator in place (no heap allocation). Input that does not fit is truncated to the buffer size. Comparison, equality, and hashing operate byte-wise over the inline buffer.

public struct String64 : IComparable<String64>, IEquatable<String64>
Implements
Inherited Members

Constructors

String64(byte*, int)

Construct a String64 instance from a memory area containing the string

public String64(byte* stringAddr, int length = 64)

Parameters

stringAddr byte*

Address of the memory area containing the UTF8 string data

length int

Length of the stringAddr memory area

Properties

AsString

Gets or sets the string value, encoded as inline UTF-8 and null-terminated. The setter truncates input that does not fit the 64-byte buffer.

public string AsString { get; set; }

Property Value

string

Methods

AsReadOnlySpan()

Exposes the 64-byte inline buffer as a ReadOnlySpan<T> of bytes. Valid only while the containing storage stays fixed in memory.

public readonly ReadOnlySpan<byte> AsReadOnlySpan()

Returns

ReadOnlySpan<byte>

AsSpan()

Exposes the 64-byte inline buffer as a mutable Span<T> of bytes. Valid only while the containing storage stays fixed in memory.

public Span<byte> AsSpan()

Returns

Span<byte>

CompareTo(String64)

Ordinal byte-wise comparison of the two inline buffers.

public int CompareTo(String64 other)

Parameters

other String64

The value to compare against.

Returns

int

Negative, zero, or positive per lexicographic byte ordering.

Equals(object)

Byte-wise equality; false when obj is not a String64.

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(String64)

Byte-wise equality of the two inline buffers.

public bool Equals(String64 other)

Parameters

other String64

The value to compare against.

Returns

bool

true when the buffers are byte-for-byte equal.

GetHashCode()

32-bit MurmurHash2 over the inline buffer bytes.

public override int GetHashCode()

Returns

int

GetStringContentAddr()

Returns a pointer to the first byte of the 64-byte inline buffer for read/write access. Valid only while the containing storage stays fixed in memory.

public byte* GetStringContentAddr()

Returns

byte*

GetStringContentAddrReaOnly()

Read-only counterpart of GetStringContentAddr(), callable on a readonly instance. Valid only while the containing storage stays fixed in memory.

public readonly byte* GetStringContentAddrReaOnly()

Returns

byte*

Operators

operator ==(String64, String64)

Byte-wise equality.

public static bool operator ==(String64 left, String64 right)

Parameters

left String64
right String64

Returns

bool

implicit operator String64(string)

Creates a String64 from a managed string, encoding it as inline UTF-8 (truncated to fit the 64-byte buffer).

public static implicit operator String64(string str)

Parameters

str string

Returns

String64

operator !=(String64, String64)

Byte-wise inequality.

public static bool operator !=(String64 left, String64 right)

Parameters

left String64
right String64

Returns

bool