1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// IStringConverterFactory.cs
//
// Copyright (c) František Boháček. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using NosSmooth.Packets.Errors;
using NosSmooth.PacketSerializer.Abstractions;
using Remora.Results;
namespace NosSmooth.Packets.Converters.Special;
/// <summary>
/// Converts special types such as enums or lists.
/// </summary>
public interface IStringConverterFactory
{
/// <summary>
/// Whether this type converter should handle the given type.
/// </summary>
/// <param name="type">The type to handle.</param>
/// <returns>Whether the type should be handled.</returns>
public bool ShouldHandle(Type type);
/// <summary>
/// Create converter for the given type.
/// </summary>
/// <param name="type">The type to create converter for.</param>
/// <returns>The type converter or an error.</returns>
public Result<IStringConverter> CreateTypeSerializer(Type type);
/// <summary>
/// Create generic converter for the given type.
/// </summary>
/// <typeparam name="T">The type to create converter for.</typeparam>
/// <returns>The type converter or an error.</returns>
public Result<IStringConverter<T>> CreateTypeSerializer<T>();
}