Struct FixedString32Bytes
An unmanaged UTF-8 string whose content is stored directly in the 32-byte struct.
Namespace: Unity.Collections
Assembly: solution.dll
Syntax
[Serializable]
public struct FixedString32Bytes : INativeList<byte>, IIndexable<byte>, IUTF8Bytes
Remarks
The binary layout of this string is guaranteed, for now and all time, to be a length (a little-endian two byte integer) followed by the bytes of the characters (with no padding). A zero byte always immediately follows the last character. Effectively, the number of bytes for storing characters is 3 less than 32 (two length bytes and one null byte).
This layout is identical to a FixedList32Bytes<T> of bytes, thus allowing reinterpretation between FixedString32Bytes and FixedList32Bytes.
By virtue of being an unmanaged, non-allocated struct with no pointers, this string is fully compatible with jobs and Burst compilation. Unlike managed string types, these strings can be put in any unmanaged ECS components, FixedList, or any other unmanaged structs.
Constructors
Name | Description |
---|---|
FixedString32Bytes(string) | Initializes and returns an instance of FixedString32Bytes with the characters copied from a string. |
FixedString32Bytes(in FixedString128Bytes) | Initializes and returns an instance of FixedString32Bytes that is a copy of another string. |
FixedString32Bytes(in FixedString32Bytes) | Initializes and returns an instance of FixedString32Bytes that is a copy of another string. |
FixedString32Bytes(in FixedString4096Bytes) | Initializes and returns an instance of FixedString32Bytes that is a copy of another string. |
FixedString32Bytes(in FixedString512Bytes) | Initializes and returns an instance of FixedString32Bytes that is a copy of another string. |
FixedString32Bytes(in FixedString64Bytes) | Initializes and returns an instance of FixedString32Bytes that is a copy of another string. |
FixedString32Bytes(in UnsafeText) | Initializes and returns an instance of FixedString32Bytes that is a copy of another string. |
FixedString32Bytes(ReadOnly) | Initializes and returns an instance of FixedString32Bytes that is a copy of another string. |
FixedString32Bytes(Rune, int) | Initializes and returns an instance of FixedString32Bytes with a single character repeatedly appended some number of times. |
Properties
Name | Description |
---|---|
Capacity | The number of bytes this string has for storing UTF-8 characters. |
IsEmpty | Returns true if this string is empty (has no characters). |
this[int] | Returns the byte (not character) at an index. |
Length | The current length in bytes of this string's content. |
UTF8MaxLengthInBytes | Returns the maximum number of UTF-8 bytes that can be stored in this string. |
Methods
Name | Description |
---|---|
Add(in byte) | Appends a byte. |
AsFixedList() | Returns a reference to a FixedList32Bytes<byte> representation of this string. |
Clear() | Sets the length to 0. |
CompareTo(string) | Returns the lexicographical sort order of this string relative to another. |
CompareTo(FixedString128Bytes) | Returns the lexicographical sort order of this string relative to another. |
CompareTo(FixedString32Bytes) | Returns the lexicographical sort order of this string relative to another. |
CompareTo(FixedString4096Bytes) | Returns the lexicographical sort order of this string relative to another. |
CompareTo(FixedString512Bytes) | Returns the lexicographical sort order of this string relative to another. |
CompareTo(FixedString64Bytes) | Returns the lexicographical sort order of this string relative to another. |
ElementAt(int) | Returns the reference to a byte (not character) at an index. |
Equals(object) | Returns true if this string and an object are equal. |
Equals(string) | Returns true if this string and another have the same length and all the same characters. |
Equals(FixedString128Bytes) | Returns true if this string and another string are equal. |
Equals(FixedString32Bytes) | Returns true if this string and another string are equal. |
Equals(FixedString4096Bytes) | Returns true if this string and another string are equal. |
Equals(FixedString512Bytes) | Returns true if this string and another string are equal. |
Equals(FixedString64Bytes) | Returns true if this string and another string are equal. |
GetEnumerator() | Returns an enumerator for iterating over the characters of this string. |
GetHashCode() | Returns a hash code of this string. |
GetUnsafePtr() | Returns a pointer to the character bytes. |
ToString() | Returns a new managed string that is a copy of this string. |
TryResize(int, NativeArrayOptions) | Attempts to set the length in bytes. Does nothing if the new length is invalid. |
Operators
Name | Description |
---|---|
operator ==(in FixedString32Bytes, in FixedString128Bytes) | Returns true if a FixedString32Bytes and another string are equal. |
operator ==(in FixedString32Bytes, in FixedString32Bytes) | Returns true if a FixedString32Bytes and another string are equal. |
operator ==(in FixedString32Bytes, in FixedString4096Bytes) | Returns true if a FixedString32Bytes and another string are equal. |
operator ==(in FixedString32Bytes, in FixedString512Bytes) | Returns true if a FixedString32Bytes and another string are equal. |
operator ==(in FixedString32Bytes, in FixedString64Bytes) | Returns true if a FixedString32Bytes and another string are equal. |
implicit operator FixedString32Bytes(string) | Returns a new FixedString32Bytes that is a copy of another string. |
implicit operator FixedString128Bytes(in FixedString32Bytes) | Returns a new FixedString128Bytes that is a copy of another string. |
implicit operator FixedString4096Bytes(in FixedString32Bytes) | Returns a new FixedString4096Bytes that is a copy of another string. |
implicit operator FixedString512Bytes(in FixedString32Bytes) | Returns a new FixedString512Bytes that is a copy of another string. |
implicit operator FixedString64Bytes(in FixedString32Bytes) | Returns a new FixedString64Bytes that is a copy of another string. |
operator !=(in FixedString32Bytes, in FixedString128Bytes) | Returns true if a FixedString32Bytes and another string are unequal. |
operator !=(in FixedString32Bytes, in FixedString32Bytes) | Returns true if a FixedString32Bytes and another string are unequal. |
operator !=(in FixedString32Bytes, in FixedString4096Bytes) | Returns true if a FixedString32Bytes and another string are unequal. |
operator !=(in FixedString32Bytes, in FixedString512Bytes) | Returns true if a FixedString32Bytes and another string are unequal. |
operator !=(in FixedString32Bytes, in FixedString64Bytes) | Returns true if a FixedString32Bytes and another string are unequal. |