Skip to main content

PipelineState

Struct PipelineState 

Source
pub struct PipelineState<St, Req, Res, Err> { /* private fields */ }
Expand description

Execution container for a service whose state is supplied per operation.

Unlike crate::Pipeline, this type does not own a state value. Callers provide a state reference when checking readiness, calling, or shutting down the service.

Implementations§

Source§

impl<St, Req, Res, Err> PipelineState<St, Req, Res, Err>
where St: 'static, Req: 'static, Res: 'static, Err: 'static,

Source

pub fn new<S>(service: impl IntoService<S, St, Req>) -> Self
where S: Service<St, Req, Res = Res, Error = Err> + 'static, St: 'static,

Creates a state-independent pipeline containing service.

Source

pub async fn ready(&self, st: &St) -> Result<(), Err>

Returns when the pipeline is ready to process requests.

A successful check is consumed by the next call, which then skips its own readiness check.

Source

pub async fn call(&self, req: Req, st: &St) -> Result<Res, Err>

Waits for readiness, then calls the service with st.

The readiness check is skipped if the last pipeline readiness check succeeded and no call has started since.

Source

pub async fn shutdown(&self, st: &St)

Shuts down the enclosed service.

Source

pub fn poll_ready(&self, cx: &mut Context<'_>, st: &St) -> Poll<Result<(), Err>>
where St: Clone,

Returns Ready when the pipeline is ready to process requests.

A successful check is consumed by the next call, which then skips its own readiness check.

§Panics

Panics if .shutdown() has been called. Unlike crate::Pipeline::poll_ready, it does not return Ready(Ok(())) after shutdown.

Source

pub fn bind(&self) -> PipelineStateBinding<St, Req, Res, Err>

Creates a binding that accepts state per call.

The binding can be used to call the service.

Source

pub fn bind_state(&self, st: St) -> PipelineBinding<Req, Res, Err>
where St: Clone,

Creates a standard pipeline binding by attaching an owned state value.

The binding can be used to call the service.

Trait Implementations§

Source§

impl<St, Req, Res, Err> Debug for PipelineState<St, Req, Res, Err>

Source§

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

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

impl<St, Req, Res, Err> Drop for PipelineState<St, Req, Res, Err>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<St, Req, Res, Err> !RefUnwindSafe for PipelineState<St, Req, Res, Err>

§

impl<St, Req, Res, Err> !Send for PipelineState<St, Req, Res, Err>

§

impl<St, Req, Res, Err> !Sync for PipelineState<St, Req, Res, Err>

§

impl<St, Req, Res, Err> !UnwindSafe for PipelineState<St, Req, Res, Err>

§

impl<St, Req, Res, Err> Freeze for PipelineState<St, Req, Res, Err>

§

impl<St, Req, Res, Err> Unpin for PipelineState<St, Req, Res, Err>

§

impl<St, Req, Res, Err> UnsafeUnpin for PipelineState<St, Req, Res, Err>

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.