TuPackUserType

Namespace: SnowBank.Data.Tuples.Binary · class

Implements: IEquatable<TuPackUserType>, ISpanFormattable, IFormattable

Represent a custom user type for the TuPack encoding

Constructors

TuPackUserType

TuPackUserType(int type)

TuPackUserType(int type, Slice value)

Methods

Custom

static TuPackUserType Custom(byte type)

Returns a custom user type with a given prefix (ex: 40)

  • type — Prefix for this type, which must be between UserType0 (0x40) and UserTypeF (0x4F)

static TuPackUserType Custom(byte type, Slice value)

Returns a custom user type with a given prefix and payload (ex: 40 XX YY ZZ ...)

  • type — Prefix for this type, which must be between UserType0 (0x40) and UserTypeF (0x4F)
  • value — Payload for this type

static TuPackUserType Custom(byte type, ReadOnlySpan<byte> value)

Returns a custom user type with a given prefix and payload (ex: 40 XX YY ZZ ...)

  • type — Prefix for this type, which must be between UserType0 (0x40) and UserTypeF (0x4F)
  • value — Payload for this type

Equals

bool Equals(object obj)

bool Equals(TuPackUserType other)

GetHashCode

int GetHashCode()

SpecialKey

static TuPackUserType SpecialKey(Slice name)

Returns a type that matches a Special key (ex: '\xFF\xFF/status/json')

  • name — Key, excluding the two initial \xFF bytes (ex: "/status/json" instead of "\xFF\xFF/status/json")

static TuPackUserType SpecialKey(ReadOnlySpan<byte> name)

Returns a type that matches a Special key (ex: '\xFF\xFF/status/json')

  • name — Key, excluding the two initial \xFF bytes (ex: "/status/json" instead of "\xFF\xFF/status/json")

static TuPackUserType SpecialKey(string name)

Returns a type that matches a Special key (ex: '\xFF\xFF/status/json')

  • name — Key, excluding the two initial \xFF bytes (ex: "/status/json" instead of "\xFF\xFF/status/json")

SystemKey

static TuPackUserType SystemKey(Slice name)

Returns a type that matches a System key (ex: '\xFF/metadataVersion')

  • name — Key, excluding the initial \xFF byte (ex: "/metadataVersion" instead of "\xFF/metadataVersion")

static TuPackUserType SystemKey(ReadOnlySpan<byte> name)

Returns a type that matches a System key (ex: '\xFF/metadataVersion')

  • name — Key, excluding the initial \xFF byte (ex: "/metadataVersion" instead of "\xFF/metadataVersion")

static TuPackUserType SystemKey(string name)

Returns a type that matches a System key (ex: '\xFF/metadataVersion')

  • name — Name of key, excluding the initial \xFF byte (ex: "/metadataVersion" instead of "\xFF/metadataVersion")

ToString

string ToString()

string ToString(string format, IFormatProvider formatProvider = null)

TryFormat

bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = null, IFormatProvider provider = null)

Fields

Directory

static readonly TuPackUserType Directory

Directory Layer (`\xFE`)

Special

static readonly TuPackUserType Special

Start of the Special Key subspace (`\xFF\xFF`)

System

static readonly TuPackUserType System

Start of the System subspace (`\xFF`)

Type

readonly int Type

Byte header of this custom user type

TypeDirectory

const byte TypeDirectory

Prefix for the Directory Layer subspace (0xFE)

TypeSystem

const byte TypeSystem

Prefix for the System subspace (0xFF)

Value

readonly Slice Value

Payload bytes of this custom user type (optional)