Rowles.LeanCorpus.Codecs.CodecKit.Codecs
Classes
CodecContext
Per-operation mutable state for codec decode/encode operations. Tracks nesting depth, diagnostic path, byte offsets, delimited scopes, and scratch buffers. Created per top-level codec call; never shared across concurrent operations.
CodecFailure
Structured failure metadata for the non-throwing
TryDecode/TryEncodepaths.
CodecOptions
Immutable configuration for codec operations. All limits are validated at construction time.
CodecRegistry
Immutable registry of checksum providers. Use the builder pattern to register providers, then build an immutable instance.
DependentFieldFactory<TDep, TOut>
Describes a dependent field whose codec is created dynamically from a previously decoded field value.
RecordBuilder<T>
Fluent builder for composing multiple field codecs into a single record codec. Fields are decoded/encoded in registration order.
VersionCaseDefinition<TBase>
A single case in a Versioned codec. Created via VersionCase<TBase, TCase>(object, string, ICodec<TCase>).
Structs
CodecCheckpoint
A saved reader position, bundled with the sequence it was captured from. Passing the sequence through ensures that nested rewinds — which may narrow
reader.Sequenceto a sub-slice — cannot invalidate an outer checkpoint.
CodecResult<T>
Represents the result of a non-throwing codec operation. Access Value on success or Failure on failure. Accessing the wrong property throws InvalidOperationException.
FieldValues
Provides named access to the decoded field values inside a Build(Func<FieldValues, T>) factory delegate. Access values by the name passed to
.Field(...)and cast to the expected type.
Unit
A type with exactly one value, used for codecs that produce no meaningful result (e.g.,
Skip,Magic,Padding).
Interfaces
ICodec<T>
A typed, bidirectional codec that encodes values of type
Tto bytes and decodes bytes back to values of typeT. Implementations must be immutable and thread-safe. All mutable state lives in CodecContext.