2020-01-11 17:56:12 +01:00
|
|
|
|
namespace Capnp.Rpc
|
2019-06-12 21:56:55 +02:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Helper struct to support tail calls
|
|
|
|
|
/// </summary>
|
|
|
|
|
public struct AnswerOrCounterquestion
|
|
|
|
|
{
|
|
|
|
|
readonly object _obj;
|
|
|
|
|
|
|
|
|
|
AnswerOrCounterquestion(object obj)
|
|
|
|
|
{
|
|
|
|
|
_obj = obj;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-12 21:48:01 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Wraps a SerializerState
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="answer">object to wrap</param>
|
2019-06-12 21:56:55 +02:00
|
|
|
|
public static implicit operator AnswerOrCounterquestion (SerializerState answer)
|
|
|
|
|
{
|
|
|
|
|
return new AnswerOrCounterquestion(answer);
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-12 21:48:01 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Wraps a PendingQuestion
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="counterquestion">object to wrap</param>
|
2019-06-12 21:56:55 +02:00
|
|
|
|
public static implicit operator AnswerOrCounterquestion (PendingQuestion counterquestion)
|
|
|
|
|
{
|
|
|
|
|
return new AnswerOrCounterquestion(counterquestion);
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-12 21:48:01 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// SerializerState, if applicable
|
|
|
|
|
/// </summary>
|
2020-01-11 17:21:31 +01:00
|
|
|
|
public SerializerState? Answer => _obj as SerializerState;
|
2019-07-12 21:48:01 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// PendingQuestion, if applicable
|
|
|
|
|
/// </summary>
|
2020-01-11 17:21:31 +01:00
|
|
|
|
public PendingQuestion? Counterquestion => _obj as PendingQuestion;
|
2019-06-12 21:56:55 +02:00
|
|
|
|
}
|
2020-01-11 17:56:12 +01:00
|
|
|
|
}
|