Revert "清理"
猿人易 authored at 2024-06-17 16:53:31
985.00 B
Stardust
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
using NewLife.Log;

namespace Stardust.Server.Common
{
    internal class JsonConverterForBuilder : JsonConverter<ISpanBuilder>
    {
        public override ISpanBuilder Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => JsonSerializer.Deserialize<DefaultSpanBuilder>(ref reader, options);

        public override void Write(Utf8JsonWriter writer, ISpanBuilder value, JsonSerializerOptions options) => JsonSerializer.Serialize(writer, value, options);
    }

    internal class JsonConverterForSpan : JsonConverter<ISpan>
    {
        public override ISpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) => JsonSerializer.Deserialize<DefaultSpan>(ref reader, options);

        public override void Write(Utf8JsonWriter writer, ISpan value, JsonSerializerOptions options) => JsonSerializer.Serialize(writer, value, options);
    }
}