Table of Contents

Struct BsonEndec<T>

Namespace
Shard.Codecs.Bson
Assembly
Shard.Codecs.dll

Executes one complete BSON read and write endpoint for a value type.

public readonly struct BsonEndec<T>

Type Parameters

T
Inherited Members

Remarks

Document codecs read and write the root directly, whereas other codecs place a value at the root inside a document with one unnamed element; nested values therefore need no additional wrapper.

Methods

Read(ReadOnlyMemory<byte>, CodecContext)

Reads one complete BSON root and validates the completed value before returning it.

public T Read(ReadOnlyMemory<byte> source, CodecContext context)

Parameters

source ReadOnlyMemory<byte>
context CodecContext

Returns

T

Write(IBufferWriter<byte>, in T, CodecContext)

Writes one complete BSON root and releases its writer state even when encoding fails.

public void Write(IBufferWriter<byte> destination, in T value, CodecContext context)

Parameters

destination IBufferWriter<byte>
value T
context CodecContext