Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UnionDiscriminator<T>

An object that can provide a {@link Union#discriminator|discriminator} API for Union.

NOTE This is an abstract base class; you can create instances if it amuses you, but they won't support the {@link UnionDiscriminator#encode|encode} or {@link UnionDiscriminator#decode|decode} functions.

param [property]

Default for {@link UnionDiscriminator#property|property}.

abstract

Type parameters

  • T = any

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

property

property: string

Methods

decode

  • decode(b?: Uint8Array, offset?: number): T
  • Analog to {@link Layout#decode|Layout decode} for union discriminators.

    The implementation of this method need not reference the buffer if variant information is available through other means.

    Parameters

    • Optional b: Uint8Array
    • Optional offset: number

    Returns T

encode

  • encode(src: T, b: Uint8Array, offset?: number): number
  • Analog to {@link Layout#decode|Layout encode} for union discriminators.

    The implementation of this method need not store the value if variant information is maintained through other means.

    Parameters

    • src: T
    • b: Uint8Array
    • Optional offset: number

    Returns number

Generated using TypeDoc