A capability reference to an object that can handle calls. We might not yet know its final location, but we may be able to pipeline messages to it anyway.
method call : struct_resolver -> Wire.Request.t -> unit
c#call results msg invokes a method on
c's target and eventually resolves
results with the answer.
method shortest : cap
c#shortest is the shortest known path to
cap. i.e. if
c is forwarding to another cap, we return that, recursively.
method when_more_resolved : (cap -> unit) -> unit
c#when_more_resolved fn calls
fn x when this cap becomes more resolved.
fn x gets a reference to
x and needs to
dec_ref it. Note that the new capability can be another promise. If
c is already resolved to its final value, this does nothing. If
c is a far-ref,
fn x will be called when it breaks. If
c is forwarding to another cap, it will forward this call. If
c gets released before calling
fn, it will never call it.
c#when_released fn will call
fn () when
c's ref-count drops to zero. This is used for caches, to remove entries when they become invalid. For promises,
fn will be transferred to the resolution if resolved. For broken caps, this method does nothing (exceptions are never released).