LionWeb-io / lionweb-csharp

Implements LionWeb specification in C#
Apache License 2.0
2 stars 0 forks source link

Request for Stream API on Serializer and Deserializer #6

Open JojoEffect opened 1 month ago

JojoEffect commented 1 month ago
public interface ISerializer
{
    /// <summary>
    /// Serializes the specified root nodes and all of their descendants to a stream.
    /// </summary>
    /// <param name="roots">The nodes to serialize.</param>
    /// <returns>The stream.</returns>
    /// <remarks>Does not serialize reference targets that are not descendants of one of the provided root nodes.</remarks>
    public Stream SerializeToStream(IEnumerable<INode> roots);
}

public interface IDeserializer
{
    /// <summary>
    /// Deserializes the specified stream to a collection of root nodes.
    /// </summary>
    /// <param name="stream">The Stream to deserialize.</param>
    /// <returns>The deserialized nodes.</returns>
    /// <remarks>Does not deserialize referenced nodes and the references to them if the referenced target node is not part of the <paramref name="stream"/>.</remarks>
    public IEnumerable<INode> Deserialize(Stream stream);
}
enikao commented 1 month ago

see #11