Hyperlinkv0.8.0-beta.28

SchemaAST

SchemaAST.UniqueSymbolclasseffect/SchemaAST.ts:1181
UniqueSymbol

AST node matching a specific unique symbol value.

Details

Parsing succeeds only when the input is reference-equal to the stored symbol.

export class UniqueSymbol extends Base {
  readonly _tag = "UniqueSymbol"
  readonly symbol: symbol

  constructor(
    symbol: symbol,
    annotations?: Schema.Annotations.Annotations,
    checks?: Checks,
    encoding?: Encoding,
    context?: Context
  ) {
    super(annotations, checks, encoding, context)
    this.symbol = symbol
  }
  /** @internal */
  getParser() {
    return fromConst(this, this.symbol)
  }
  /** @internal */
  toCodecStringTree(): AST {
    return replaceEncoding(this, [symbolToString])
  }
  /** @internal */
  getExpected(): string {
    return globalThis.String(this.symbol)
  }
}
Referenced by 2 symbols