Class SyntaxPieceRecord
- Namespace
- Hi.MachiningSteps
- Assembly
- HiMech.dll
Internal Use Only. The record of one executed SyntaxPiece as the result recording takes it: the snapshot of the piece's sentence and the piece's parse result as compact UTF-8 JSON. Taken on SyntaxPieceRan, on the player's thread. The snapshot is the one interned for the piece (Of(ISentenceCarrier)), the same object the step records built from the piece carry: the reference under which the recorder hands the piece its id. The JSON is the frozen bytes of a frozen piece, wrapped and not copied, or the live graph serialized at the call with CompactNanOptions, the freeze's encoding – the content of that moment: the pipeline may still write a piece until the next piece's first act entry, so a record taken before that boundary and the piece's frozen bytes agree byte for byte only from it on. A piece without a parse result has an empty CompactUtf8Json and HasJson false.
public sealed class SyntaxPieceRecord
- Inheritance
-
SyntaxPieceRecord
- Inherited Members
- Extension Methods
Constructors
SyntaxPieceRecord(SentenceSnapshot, ReadOnlyMemory<byte>, bool)
Initializes a record from its parts, which it keeps as they are given: the sampling is Of(SyntaxPiece)'s. For a reader that rebuilds the record from a store.
public SyntaxPieceRecord(SentenceSnapshot sentence, ReadOnlyMemory<byte> compactUtf8Json, bool hasJson)
Parameters
sentenceSentenceSnapshotThe snapshot of the piece's sentence; not null.
compactUtf8JsonReadOnlyMemory<byte>The parse result as compact UTF-8 JSON; empty when there is none.
hasJsonboolWhether the piece had a parse result.
Exceptions
- ArgumentNullException
sentenceis null.
Properties
CompactUtf8Json
The piece's parse result as compact UTF-8 JSON (NaN and the infinities as quoted literals, explicit nulls kept): a frozen piece's own bytes, a live piece's serialized at the call. Empty when the piece has no parse result (HasJson).
public ReadOnlyMemory<byte> CompactUtf8Json { get; }
Property Value
HasJson
Whether the piece had a parse result at all: false for a piece without a JsonObject, whose CompactUtf8Json is empty.
public bool HasJson { get; }
Property Value
Sentence
The snapshot of the piece's sentence, the one interned for the piece: the record's key. Never null.
public SentenceSnapshot Sentence { get; }
Property Value
SentenceIndex
public int SentenceIndex { get; }
Property Value
Methods
Of(SyntaxPiece)
Internal Use Only. The record of piece as it is now: the snapshot
interned for the piece and the piece's parse result as compact UTF-8 JSON. Serializing a
live piece another thread is writing can throw out of the node tree; the recorder, which
samples off the pipeline's thread, catches. A null piece – the HardNc runner's – is
refused: the recorder skips it.
public static SyntaxPieceRecord Of(SyntaxPiece piece)
Parameters
pieceSyntaxPieceThe piece; not null.
Returns
- SyntaxPieceRecord
The record.
Exceptions
- ArgumentNullException
pieceis null.