Section navigation

Public namespace Rowles.LeanCorpus.Codecs.CodecKit.Codecs

Classes

Public class 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.

Public class CodecFailure

Structured failure metadata for the non-throwing TryDecode/TryEncode paths.

Public class CodecOptions

Immutable configuration for codec operations. All limits are validated at construction time.

Public class CodecRegistry

Immutable registry of checksum providers. Use the builder pattern to register providers, then build an immutable instance.

Public class DependentFieldFactory<TDep, TOut>

Describes a dependent field whose codec is created dynamically from a previously decoded field value.

Public class RecordBuilder<T>

Fluent builder for composing multiple field codecs into a single record codec. Fields are decoded/encoded in registration order.

Public class VersionCaseDefinition<TBase>

A single case in a Versioned codec. Created via VersionCase<TBase, TCase>(object, string, ICodec<TCase>).

Structs

Public struct 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.Sequence to a sub-slice — cannot invalidate an outer checkpoint.

Public struct 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.

Public struct 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.

Public struct Unit

A type with exactly one value, used for codecs that produce no meaningful result (e.g., Skip, Magic, Padding).

Interfaces

Public interface ICodec<T>

A typed, bidirectional codec that encodes values of type T to bytes and decodes bytes back to values of type T. Implementations must be immutable and thread-safe. All mutable state lives in CodecContext.