using CanonSharp.Combinator.Abstractions; namespace CanonSharp.Combinator.Results; /// /// 错误类型的失败解析结果 /// /// 输入流的类型 /// 输入流的读取类型 /// 实际的结果类型 internal sealed class FailedResultWithError(TState state) : IFailedResult where TState : IReadState { public IReadState State => state; public string Message => $"Unexpected state: {state}."; public IFailedResult Convert() { return new FailedResultWithError(state); } public override string ToString() => $"Parse failed: {Message}."; }