diff --git a/Capnp.Net.Runtime/DynamicSerializerState.cs b/Capnp.Net.Runtime/DynamicSerializerState.cs index d6092c6..dccfd69 100644 --- a/Capnp.Net.Runtime/DynamicSerializerState.cs +++ b/Capnp.Net.Runtime/DynamicSerializerState.cs @@ -89,6 +89,11 @@ namespace Capnp /// The object type was already set to something different public new void SetStruct(ushort dataCount, ushort ptrCount) => base.SetStruct(dataCount, ptrCount); + /// + /// Determines the underyling object to be a capability. + /// + /// Capability table index, or null to encode a null pointer + /// The object type was already set to something different public new void SetCapability(uint? capabilityIndex) => base.SetCapability(capabilityIndex); /// diff --git a/Capnp.Net.Runtime/Rpc/Impatient.cs b/Capnp.Net.Runtime/Rpc/Impatient.cs index a7be980..1376a3c 100644 --- a/Capnp.Net.Runtime/Rpc/Impatient.cs +++ b/Capnp.Net.Runtime/Rpc/Impatient.cs @@ -156,6 +156,16 @@ namespace Capnp.Rpc } } + /// + /// Unwraps given capability. Unwrapping walks the chain of promised capabilities and awaits their resolutions, + /// until we get the finally resolved capability. If it is the capability, the method returns a null reference. + /// If the capability is broken (resolved to exception, dependent answer faulted or cancelled, RPC endpoint closed), + /// it throws an exception. + /// + /// Capability interface + /// capability to unwrap + /// Task returning the eventually resolved capability + /// Capability is broken public static async Task Unwrap(this TInterface cap) where TInterface: class, IDisposable { using var proxy = cap as Proxy; diff --git a/Capnp.Net.Runtime/SerializerState.cs b/Capnp.Net.Runtime/SerializerState.cs index cb219d1..629f940 100644 --- a/Capnp.Net.Runtime/SerializerState.cs +++ b/Capnp.Net.Runtime/SerializerState.cs @@ -497,6 +497,11 @@ namespace Capnp } } + /// + /// Determines the underyling object to be a capability. + /// + /// Capability table index, or null to encode a null pointer + /// The object type was already set to something different protected void SetCapability(uint? capabilityIndex) { if (capabilityIndex.HasValue)