pub struct PendingCall<T> { /* private fields */ }Expand description
An async call in flight: a render sender creation (crate::Session::start_render_sender),
an onboard or rejoin (crate::Runtime::start_onboard,
crate::Runtime::start_rejoin), a co-process invite
(crate::Session::start_onboarding_invite), a target-app invite or kill
(crate::Session::start_invite_target_app, crate::Session::start_kill_target_app), or a
begin-frame (crate::RenderSender::start_owned_frame). It keeps its owner alive.
The library calls back exactly once: with the outcome, or with
crate::StatusCode::TIMEOUT once the call’s cancel token is cancelled
(PendingCall::cancel_handle, the start’s timeout, or dropping this value). A cancel
arriving just as the call finishes may still deliver the outcome.
Dropping it before the outcome is taken cancels the call and returns at once. The owner keeps the call until its callback: a handle it still delivers is destroyed by the owner’s next call or by the owner’s teardown, whose destroy waits for the callback.
Implementations§
Source§impl<T> PendingCall<T>
impl<T> PendingCall<T>
Sourcepub fn poll(&mut self) -> Option<Result<T>>
pub fn poll(&mut self) -> Option<Result<T>>
Never blocks. None while the call runs; once it called back, the value or the error it
delivered (crate::StatusCode::TIMEOUT for a cancelled or timed-out call). Polling
again after that returns Error::InvalidArgument.
Sourcepub fn wait(self) -> Result<T>
pub fn wait(self) -> Result<T>
Blocks until the library called back, which the header guarantees, and returns what
PendingCall::poll would.
Sourcepub fn cancel_handle(&self) -> Option<CancelHandle>
pub fn cancel_handle(&self) -> Option<CancelHandle>
Cancels the call from any thread while it runs; the library then calls back with
crate::StatusCode::TIMEOUT (or the outcome, when the call was just finishing).
None once the outcome was taken.