Struct AssetUid¶
Namespace: Apogee.Core.Assets
Assembly: Apogee.Core.dll
The identity of an asset that survives a rename or a move: 64 random bits. uid:// followed by 13 characters of lowercase Crockford base32 (0-9a-hjkmnp-tv-z), most
significant digit first; the first digit holds the remaining 4 bits, so it is at most f.
public readonly record struct AssetUid : IEquatable<AssetUid>
Implements¶
Inherited Members¶
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors¶
AssetUid(ulong)¶
The identity of an asset that survives a rename or a move: 64 random bits. uid:// followed by 13 characters of lowercase Crockford base32 (0-9a-hjkmnp-tv-z), most
significant digit first; the first digit holds the remaining 4 bits, so it is at most f.
public AssetUid(ulong Value)
Parameters¶
Value ulong
The 64-bit value; zero is
Fields¶
DigitCount¶
The number of base32 characters after the scheme.
public const int DigitCount = 13
Field Value¶
Scheme¶
The text that starts every UID: uid://.
public const string Scheme = "uid://"
Field Value¶
Properties¶
IsNone¶
Whether this is
public bool IsNone { get; }
Property Value¶
None¶
No UID (value zero).
public static AssetUid None { get; }
Property Value¶
Value¶
The 64-bit value; zero is
public ulong Value { get; init; }
Property Value¶
Methods¶
New()¶
Mints a UID: 64 random bits from the system's cryptographic generator, never zero.
public static AssetUid New()
Returns¶
Parse(ReadOnlySpan<char>)¶
Reads the text form (see
public static AssetUid Parse(ReadOnlySpan<char> text)
Parameters¶
text ReadOnlySpan<char>
Returns¶
Exceptions¶
The text is not a valid UID.
ToString()¶
The text form, uid:// and 13 base32 characters;
public override string ToString()
Returns¶
TryParse(ReadOnlySpan<char>, out AssetUid)¶
Reads the text form. Case does not matter. Fails on a missing scheme, a length other than 13 digits, a character outside the
alphabet (i, l, o and u included), a first digit above f (it would not fit in 64 bits) and the value zero.
public static bool TryParse(ReadOnlySpan<char> text, out AssetUid uid)
Parameters¶
text ReadOnlySpan<char>
The text, with no surrounding spaces.
uid AssetUid
The UID, or
Returns¶
Whether the text was a valid UID.