Unity Engine documentation Script Reference Unity.Collections FixedString4096Bytes An unmanaged UTF-8 string whose content is stored directly in the 4096-byte struct.
Read time 3 minutes
Last updated 6 days ago Definition
Type: Struct
Namespace: Unity.Collections
Assembly: UnityEngine.ManagedKernelModule
Implements: INativeList<byte> , IIndexable<byte> , IUTF8Bytes , IComparable<string> , IEquatable<string> , IComparable<FixedString32Bytes> , IEquatable<FixedString32Bytes> , IComparable<FixedString64Bytes> , IEquatable<FixedString64Bytes> , IComparable<FixedString128Bytes> , IEquatable<FixedString128Bytes> , IComparable<FixedString512Bytes> , IEquatable<FixedString512Bytes> , IComparable<FixedString4096Bytes> , IEquatable<FixedString4096Bytes>
public struct FixedString4096Bytes : INativeList<byte>, IIndexable<byte>, IUTF8Bytes, IComparable<string>, IEquatable<string>, IComparable<FixedString32Bytes>, IEquatable<FixedString32Bytes>, IComparable<FixedString64Bytes>, IEquatable<FixedString64Bytes>, IComparable<FixedString128Bytes>, IEquatable<FixedString128Bytes>, IComparable<FixedString512Bytes>, IEquatable<FixedString512Bytes>, IComparable<FixedString4096Bytes>, IEquatable<FixedString4096Bytes>
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 4096 (two length bytes and one null byte).
This layout is identical to a
FixedList4096Bytes<T> of bytes, thus allowing reinterpretation between FixedString4096Bytes and FixedList4096Bytes.
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
Properties
Property 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[] Returns the byte (not character) at an index. Length The current length in bytes of this string's content. Value For internal use only. Use FixedString4096Bytes.ToString instead.
Static Properties
Property Description UTF8MaxLengthInBytes Returns the maximum number of UTF-8 bytes that can be stored in this string.
Methods
Method Description Add Appends a byte. AsFixedList Returns a reference to a FixedList4096Bytes\<byte\> representation of this string. Clear Sets the length to 0. CompareTo Returns the lexicographical sort order of this string relative to another. ElementAt Returns the reference to a byte (not character) at an index. Equals Returns true if this string and an object 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 Attempts to set the length in bytes. Does nothing if the new length is invalid.
Operators
Operator Description operator == Returns true if a FixedString4096Bytes and another string are equal. FixedString4096Bytes Returns a new FixedString4096Bytes that is a copy of another string. operator != Returns true if a FixedString4096Bytes and another string are unequal.
Structs