pub struct RestoreSessionBuilder<Counterpart, Request, BlockState = NonBlocking>{ /* private fields */ }Expand description
Stable protocol v1 builder for session/load or session/resume.
Use ConnectionTo::load_session or ConnectionTo::resume_session to
construct this builder. Use the matching _from method to send an existing
typed request without rebuilding it.
The BlockState parameter mirrors SessionBuilder:
NonBlockingexposeson_session_starton each concrete operation.Blocking, selected withSelf::block_task, exposesstart_session.
Session routing is acknowledged before the request can reach the peer.
Dropping a pending blocking start removes that routing and applies the
standard SentRequest drop-time cancellation
behavior. Error responses remove the route before later entries in the same
transport frame are dispatched.
Implementations§
Source§impl<Counterpart, Request> RestoreSessionBuilder<Counterpart, Request, NonBlocking>
impl<Counterpart, Request> RestoreSessionBuilder<Counterpart, Request, NonBlocking>
Sourcepub fn block_task(self) -> RestoreSessionBuilder<Counterpart, Request, Blocking>
pub fn block_task(self) -> RestoreSessionBuilder<Counterpart, Request, Blocking>
Mark this restore builder as able to block the current task.
Do not use the resulting blocking methods inside a message handler.
Source§impl<Counterpart> RestoreSessionBuilder<Counterpart, LoadSessionRequest>
impl<Counterpart> RestoreSessionBuilder<Counterpart, LoadSessionRequest>
Sourcepub fn on_session_start<F, Fut>(self, op: F) -> Result<(), Error>where
F: FnOnce(RestoredSession<'static, Counterpart, LoadSessionResponse>) -> Fut + Send + 'static,
Fut: Future<Output = Result<(), Error>> + Send,
pub fn on_session_start<F, Fut>(self, op: F) -> Result<(), Error>where
F: FnOnce(RestoredSession<'static, Counterpart, LoadSessionResponse>) -> Fut + Send + 'static,
Fut: Future<Output = Result<(), Error>> + Send,
Restore with session/load in the background and run op once its
exact response and active session are available.
This returns immediately and is safe to call from a message handler. Replay notifications can arrive before the response and are retained by the returned session.
Source§impl<Counterpart> RestoreSessionBuilder<Counterpart, ResumeSessionRequest>
impl<Counterpart> RestoreSessionBuilder<Counterpart, ResumeSessionRequest>
Sourcepub fn on_session_start<F, Fut>(self, op: F) -> Result<(), Error>where
F: FnOnce(RestoredSession<'static, Counterpart, ResumeSessionResponse>) -> Fut + Send + 'static,
Fut: Future<Output = Result<(), Error>> + Send,
pub fn on_session_start<F, Fut>(self, op: F) -> Result<(), Error>where
F: FnOnce(RestoredSession<'static, Counterpart, ResumeSessionResponse>) -> Fut + Send + 'static,
Fut: Future<Output = Result<(), Error>> + Send,
Restore with session/resume in the background and run op once its
exact response and active session are available.
This returns immediately and is safe to call from a message handler. The returned session receives subsequent session traffic.
Source§impl<Counterpart> RestoreSessionBuilder<Counterpart, LoadSessionRequest, Blocking>
impl<Counterpart> RestoreSessionBuilder<Counterpart, LoadSessionRequest, Blocking>
Sourcepub async fn start_session(
self,
) -> Result<RestoredSession<'static, Counterpart, LoadSessionResponse>, Error>
pub async fn start_session( self, ) -> Result<RestoredSession<'static, Counterpart, LoadSessionResponse>, Error>
Publish session/load, wait on the current task, and return an
ActiveSession together with the exact LoadSessionResponse.
Requires block_task. Dropping
this future while it is pending cancels the request and removes the
provisional session route.
Source§impl<Counterpart> RestoreSessionBuilder<Counterpart, ResumeSessionRequest, Blocking>
impl<Counterpart> RestoreSessionBuilder<Counterpart, ResumeSessionRequest, Blocking>
Sourcepub async fn start_session(
self,
) -> Result<RestoredSession<'static, Counterpart, ResumeSessionResponse>, Error>
pub async fn start_session( self, ) -> Result<RestoredSession<'static, Counterpart, ResumeSessionResponse>, Error>
Publish session/resume, wait on the current task, and return an
ActiveSession together with the exact ResumeSessionResponse.
Requires block_task. Dropping
this future while it is pending cancels the request and removes the
provisional session route.