Files
Studio/Assets/Scripts/ExternalAssets/MessagePack/Formatters/IgnoreFormatter`1.cs
2025-05-21 12:10:38 +09:00

23 lines
658 B
C#

// Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Buffers;
#nullable enable
namespace MessagePack.Formatters
{
public sealed class IgnoreFormatter<T> : IMessagePackFormatter<T?>
{
public void Serialize(ref MessagePackWriter writer, T? value, MessagePackSerializerOptions options)
{
writer.WriteNil();
}
public T? Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options)
{
reader.Skip();
return default(T);
}
}
}