Skip to main content

RestoreSessionBuilder

Struct RestoreSessionBuilder 

Source
pub struct RestoreSessionBuilder<Counterpart, Request, BlockState = NonBlocking>
where Counterpart: HasPeer<Agent>, BlockState: SessionBlockState,
{ /* 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:

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>
where Counterpart: HasPeer<Agent>,

Source

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>
where Counterpart: HasPeer<Agent>,

Source

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>
where Counterpart: HasPeer<Agent>,

Source

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>
where Counterpart: HasPeer<Agent>,

Source

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>
where Counterpart: HasPeer<Agent>,

Source

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.

Trait Implementations§

Source§

impl<Counterpart, Request: Debug, BlockState> Debug for RestoreSessionBuilder<Counterpart, Request, BlockState>
where Counterpart: HasPeer<Agent> + Debug, BlockState: SessionBlockState + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Counterpart, Request, BlockState = NonBlocking> !RefUnwindSafe for RestoreSessionBuilder<Counterpart, Request, BlockState>

§

impl<Counterpart, Request, BlockState = NonBlocking> !UnwindSafe for RestoreSessionBuilder<Counterpart, Request, BlockState>

§

impl<Counterpart, Request, BlockState> Freeze for RestoreSessionBuilder<Counterpart, Request, BlockState>
where ConnectionTo<Counterpart>: Freeze, Request: Freeze, PhantomData<BlockState>: Freeze,

§

impl<Counterpart, Request, BlockState> Send for RestoreSessionBuilder<Counterpart, Request, BlockState>
where ConnectionTo<Counterpart>: Send, Request: Send, PhantomData<BlockState>: Send,

§

impl<Counterpart, Request, BlockState> Sync for RestoreSessionBuilder<Counterpart, Request, BlockState>
where ConnectionTo<Counterpart>: Sync, Request: Sync, PhantomData<BlockState>: Sync,

§

impl<Counterpart, Request, BlockState> Unpin for RestoreSessionBuilder<Counterpart, Request, BlockState>
where ConnectionTo<Counterpart>: Unpin, Request: Unpin, PhantomData<BlockState>: Unpin,

§

impl<Counterpart, Request, BlockState> UnsafeUnpin for RestoreSessionBuilder<Counterpart, Request, BlockState>
where ConnectionTo<Counterpart>: UnsafeUnpin, Request: UnsafeUnpin, PhantomData<BlockState>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more