Table of Contents

Class PreparedMatcher

Namespace
CStructSharp
Assembly
CStructSharp.dll

Immutable runtime recognition decisions, reusable with independent execution state on any thread.

public sealed class PreparedMatcher
Inheritance
PreparedMatcher
Inherited Members

Remarks

Only selected magic rules, or evaluable expect rules when no magic rule is evaluable, participate. Supports and dynamic positions remain unchecked. Input starts at the record; unrelated trailing fields need not be present. No bytes, caller variables or execution context are retained.

Properties

Rules

Gets every direct rule in declaration order, including explicitly excluded rules.

public IReadOnlyList<MatchRule> Rules { get; }

Property Value

IReadOnlyList<MatchRule>

Methods

Matches(ReadOnlySpan<byte>, IReadOnlyDictionary<string, int>?)

Recognizes a record without materializing fields or allocating scalar boxes.

public bool Matches(ReadOnlySpan<byte> source, IReadOnlyDictionary<string, int>? variables = null)

Parameters

source ReadOnlySpan<byte>

Record bytes starting at offset zero. A short required field returns false.

variables IReadOnlyDictionary<string, int>

Integer overrides; never mutated or retained. Unknown extra names are ignored.

Returns

bool

Whether all selected conditions evaluate to nonzero.

Exceptions

ArgumentException

A selected condition uses a missing caller variable.

CStructLayoutException

Expression work or depth limits are exceeded.