DecodeSink
Defined in: packages/format-core/src/decode-sink.ts:10
Callbacks a DecodeDriver invokes per DecodeResult variant.
A plain callbacks object rather than an event map — mirrors net/core’s
TransportHandlers: the driver has exactly one consumer and this is a hot
path, so dispatcher machinery is not worth its per-value cost here.
Type Parameters
Section titled “Type Parameters”T
W = never
Methods
Section titled “Methods”onDecoded()
Section titled “onDecoded()”onDecoded(
value,consumed,extra):void
Defined in: packages/format-core/src/decode-sink.ts:12
One value decoded. body, when present, must be drained by the caller.
Parameters
Section titled “Parameters”T
consumed
Section titled “consumed”number
warnings?
Section titled “warnings?”readonly W[]
Returns
Section titled “Returns”void
onError()
Section titled “onError()”onError(
error,consumed):void
Defined in: packages/format-core/src/decode-sink.ts:19
A recoverable violation. consumed units were dropped; decoding continues.
Parameters
Section titled “Parameters”unknown
consumed
Section titled “consumed”number
Returns
Section titled “Returns”void
onFatal()
Section titled “onFatal()”onFatal(
error):void
Defined in: packages/format-core/src/decode-sink.ts:22
An unrecoverable violation. The driver is no longer usable.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”void
onIncomplete()
Section titled “onIncomplete()”onIncomplete(
needAtLeast):void
Defined in: packages/format-core/src/decode-sink.ts:25
More input is needed before the next decode attempt can succeed.
Parameters
Section titled “Parameters”needAtLeast
Section titled “needAtLeast”number | undefined
Returns
Section titled “Returns”void
onPending()
Section titled “onPending()”onPending(
frameTimeout):void
Defined in: packages/format-core/src/decode-sink.ts:28
Input is present but only silence delimits the value.
Parameters
Section titled “Parameters”frameTimeout
Section titled “frameTimeout”number
Returns
Section titled “Returns”void
onTruncated()
Section titled “onTruncated()”onTruncated(
needAtLeast):void
Defined in: packages/format-core/src/decode-sink.ts:41
No more input will ever arrive and the decoder still could not reach a
verdict (an incomplete that never resolved, or a pending that stayed
pending after one final attempt with timedOut forced).
Deliberately carries no error: the driver has no way to construct an
E-typed value for an arbitrary decoder-owned error type. The caller knows
how to report “truncated” in its own vocabulary — FrameLink reports it
the same way it reports a transport failure, decodeAll surfaces it as a
truncated flag alongside whatever leftover bytes remain.
Parameters
Section titled “Parameters”needAtLeast
Section titled “needAtLeast”number | undefined
Returns
Section titled “Returns”void