~ruther/NosSmooth

ref: ba49ad7e1b0431be4a22b3209670e439050b2548 NosSmooth/Core/NosSmooth.Packets/Converters/Special/IStringConverterFactory.cs -rw-r--r-- 1.2 KiB
ba49ad7e — František Boháček Merge pull request #14 from Rutherther/packets-span 3 years ago
                                                                                
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
//
//  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 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>();
}
Do not follow this link