Skip to main content

Ctx

Struct Ctx 

Source
pub struct Ctx<'a, Svc: ?Sized, St = ()> { /* private fields */ }

Implementations§

Source§

impl<'a, Svc, St> Ctx<'a, Svc, St>

Source

pub fn id(&self) -> u32

Unique id for this pipeline

Source

pub fn st(&'a self) -> &'a St

Service state

Source

pub async fn ready<S, Req>(&self, svc: &'a S) -> Result<(), S::Error>
where S: Service<St, Req>,

Returns when the service is able to process requests.

Source

pub async fn call<S, Req>( &self, svc: &'a S, req: Req, ) -> Result<S::Res, S::Error>
where S: Service<St, Req>,

Wait for service readiness and then call service

Source

pub async fn call_nowait<S, Req>( &self, svc: &'a S, req: Req, ) -> Result<S::Res, S::Error>
where S: Service<St, Req>,

Call service, do not check service readiness

Source

pub async fn poll_fn<F, R>(&'a self, f: F) -> R
where F: Fn(&mut Context<'a>) -> Poll<R>,

Execute a closure until completion with the dispatcher’s task Context.

Source

pub fn poll_once<F, R>(&'a self, f: F) -> R
where F: FnOnce(&mut Context<'a>) -> R,

Execute a closure with the dispatcher’s task Context.

Source

pub async fn shutdown<S, Req>(&self, svc: &'a S)
where S: Service<St, Req>,

Shutdown service

Source

pub fn map_state<NewSt>(&'a self, st: &'a NewSt) -> Ctx<'a, Self, NewSt>

Map context state

Trait Implementations§

Source§

impl<S, St> Clone for Ctx<'_, S, St>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S, St> Copy for Ctx<'_, S, St>

Source§

impl<S, St> Debug for Ctx<'_, S, St>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<S, St> Deref for Ctx<'_, S, St>

Source§

type Target = St

The resulting type after dereferencing.
Source§

fn deref(&self) -> &St

Dereferences the value.

Auto Trait Implementations§

§

impl<'a, Svc, St = ()> !RefUnwindSafe for Ctx<'a, Svc, St>

§

impl<'a, Svc, St = ()> !Send for Ctx<'a, Svc, St>

§

impl<'a, Svc, St = ()> !Sync for Ctx<'a, Svc, St>

§

impl<'a, Svc, St = ()> !UnwindSafe for Ctx<'a, Svc, St>

§

impl<'a, Svc, St> Freeze for Ctx<'a, Svc, St>
where &'a St: Freeze, PhantomData<Rc<Svc>>: Freeze, Svc: ?Sized,

§

impl<'a, Svc, St> Unpin for Ctx<'a, Svc, St>
where &'a St: Unpin, PhantomData<Rc<Svc>>: Unpin, Svc: ?Sized,

§

impl<'a, Svc, St> UnsafeUnpin for Ctx<'a, Svc, St>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.