71 TokenType.StartObject =>
TokenType.EndObject,
72 TokenType.StartArray =>
TokenType.EndArray,
75 TokenType.StartDocument =>
TokenType.EndDocument,
76 _ =>
throw new ArgumentOutOfRangeException(nameof(start), start,
null)
92 protected string UnexpectedTypeDecodingMessage(
FaunaType faunaType) =>
93 $
"Unable to deserialize `{faunaType.GetType().Name}.{faunaType}` with `{GetType().Name}`. " +
94 $
"Supported types are [{string.Join(",
", GetSupportedTypes().Select(x => $"{x.GetType().Name}.{x}
"))}]";
124 new($
"Unexpected token while deserializing: {token}");
Represents error that occur during serialization and deserialization of Fauna data.
A class representing the mapping context to be used during serialization and deserialization.
An abstract class encapsulating common serialization and deserialization logic.
string UnsupportedSerializationTypeMessage(Type type)
A helper to build an unsupported serialization type exception message.
static TokenType EndTokenFor(TokenType start)
Gets the end token for a given start token.
virtual List< FaunaType > GetSupportedTypes()
Supported types for the serializer.
Provides functionality for writing data in a streaming manner to a buffer or a stream.
A generic interface that defines serialize and deserialize behavior for a specific type,...
void Serialize(MappingContext ctx, Utf8FaunaWriter writer, object? o)
Serializes the provided object into the Utf8FaunaWriter.
new T Deserialize(MappingContext ctx, ref Utf8FaunaReader reader)
Consumes all or some of a Utf8FaunaReader and returns an instance of T .
object? Deserialize(MappingContext ctx, ref Utf8FaunaReader reader)
Consumes all or some of a Utf8FaunaReader and returns an object or null.
List< FaunaType > GetSupportedTypes()
A list of types to which the ISerializer applies.
object? ISerializer. Deserialize(MappingContext ctx, ref Utf8FaunaReader reader)
Consumes or partially consumes the provided reader and deserializes into a result.
void ISerializer. Serialize(MappingContext context, Utf8FaunaWriter writer, object? o)
Serializes the provided object onto the Utf8FaunaWriter
FaunaType
An enum representing possible Fauna types.
TokenType
Enumerates the types of tokens used in Fauna serialization.
Represents a reader that provides fast, non-cached, forward-only access to serialized data.