Table of Contents

Class ProtobufSerializer

Namespace
ShapeShift.Protobuf
Assembly
ShapeShift.Protobuf.dll

Serializes PolyType-described object graphs to the protobuf-style binary encoding used by this package.

public record ProtobufSerializer : ShapeShiftSerializer<ProtobufEncoder, ProtobufDecoder>, IEquatable<ShapeShiftSerializer<ProtobufEncoder, ProtobufDecoder>>, IEquatable<ProtobufSerializer>
Inheritance
ProtobufSerializer
Implements
Inherited Members

Methods

Deserialize<T>(ReadOnlySpan<byte>)

Deserializes a value from a protobuf-style binary payload.

public T? Deserialize<T>(ReadOnlySpan<byte> payload) where T : IShapeable<T>

Parameters

payload ReadOnlySpan<byte>

The encoded bytes.

Returns

T

The deserialized value.

Type Parameters

T

The value type.

Deserialize<T, TProvider>(ReadOnlySpan<byte>)

Deserializes a value from a protobuf-style binary payload using a specified shape provider.

public T? Deserialize<T, TProvider>(ReadOnlySpan<byte> payload) where TProvider : IShapeable<T>

Parameters

payload ReadOnlySpan<byte>

The encoded bytes.

Returns

T

The deserialized value.

Type Parameters

T

The value type.

TProvider

The type shape provider.

Serialize<T>(in T?)

Serializes a value as a protobuf-style binary payload.

public byte[] Serialize<T>(in T? value) where T : IShapeable<T>

Parameters

value T

The value to serialize.

Returns

byte[]

The binary payload.

Type Parameters

T

The value type.

Serialize<T, TProvider>(in T?)

Serializes a value as a protobuf-style binary payload using a specified shape provider.

public byte[] Serialize<T, TProvider>(in T? value) where TProvider : IShapeable<T>

Parameters

value T

The value to serialize.

Returns

byte[]

The binary payload.

Type Parameters

T

The value type.

TProvider

The shape provider.