pub struct CallHandle<'a> { /* private fields */ }Expand description
A handle for waiting on the return values of remote procedure calls. This is necessary because calling a remote procedure
requires .flush() to be called, so waiting inside a function like .call() would make very little sense.
Implementations§
Source§impl<'a> CallHandle<'a>
impl<'a> CallHandle<'a>
Sourcepub async fn wait<T: DeserializeOwned>(self) -> Result<T, Error>
pub async fn wait<T: DeserializeOwned>(self) -> Result<T, Error>
Waits for the procedure call to complete and returns the result.
Termination behaviour: if the wire terminates during this call, the completion lock on the message this waits
for will be explicitly poisoned, causing this call to fail with [Error::LockPoisoned].
Sourcepub async fn wait_chunks<T: DeserializeOwned>(
self,
) -> Result<Option<Vec<T>>, Error>
pub async fn wait_chunks<T: DeserializeOwned>( self, ) -> Result<Option<Vec<T>>, Error>
Same as .wait(), but this will use chunk-based deserialisation, and is intended for use with procedures that send
sequences of discrete values gradually over the wire. For more information, see Interface::get_chunks.
Termination behaviour: if the wire terminates during this call, the completion lock on the message this waits
for will be explicitly poisoned, causing this call to fail with [Error::LockPoisoned].
Sourcepub async fn wait_chunk_stream(self) -> Result<ChunkReceiverHandle, Error>
pub async fn wait_chunk_stream(self) -> Result<ChunkReceiverHandle, Error>
Creates a [ChunkReceiverHandle] for incrementally receiving each chunk as it arrives. This can be used for accessing
data in a semi-realtime way while still abstracting over the issue of partial chunks. This will wait until the
first response data is received before creating a channel.
Termination behaviour: if the wire terminates while a receiver is still held, that receiver will be intelligently poisoned, and any remaining values will be yielded, before an error is returned that the wire was terminated.
Sourcepub async fn wait_bytes(self) -> Result<Vec<Vec<u8>>, Error>
pub async fn wait_bytes(self) -> Result<Vec<Vec<u8>>, Error>
Same as .wait(), but this works directly with bytes. This will return the chunks in the message (to learn more about
chunks, see Interface).
Termination behaviour: if the wire terminates during this call, the completion lock on the message this waits
for will be explicitly poisoned, causing this call to fail with [Error::LockPoisoned].
Sourcepub fn into_response_idx(self) -> IpfiInteger
pub fn into_response_idx(self) -> IpfiInteger
Turns this call handle into the response index that can be used directly with the Interface.
This allows using lower-level methods on the interface that aren’t accessible on the call
handle, but you generally won’t need these.
This is typically required when you want to check whether or not a call handle is ready to yield.
Warning: calling this will remove the underlying response index from a list the Wire maintains
of response buffers that haven’t been accessed yet. It uses this list to auto-poison those messages’
completion locks so that waiting handles don’t hang forever if the wire terminates, but, once this is
called, that tracking can no longer occur! If you call this method, you should be extra careful about
how you handle a terminating wire, as there will be no automatic poisoning of this response buffer anymore!