Skip to main content

Pipeline

Struct Pipeline 

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

Container for a service.

Provides a way to call the enclosed service and share its readiness state.

Implementations§

Source§

impl<Req, Res, Err> Pipeline<Req, Res, Err>
where Req: 'static, Res: 'static, Err: 'static,

Source

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

Construct new service pipeline instance with default state.

Source

pub fn with<S, St>( st: St, f: impl IntoService<S, St, Req>, ) -> Pipeline<Req, Res, Err>
where S: Service<St, Req, Res = Res, Error = Err> + 'static, St: 'static,

Construct new service pipeline instance with state.

Source

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

Returns when the pipeline is ready to process requests.

Source

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

Wait for service readiness, then create a future that resolves to the service call result.

Source

pub fn call_static(&self, req: Req) -> PipelineCall<Req, Res, Err>

Wait for service readiness, then create a future that resolves to the service result.

This call can be completed from different async tasks.

Source

pub fn call_nowait(&self, req: Req) -> PipelineCall<Req, Res, Err>

Call the service and create a future that resolves to the service result.

This call can be completed from different async tasks. Note: this call does not check service readiness.

Source

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

Returns Ready when the pipeline is ready to process requests.

Source

pub fn poll_shutdown(&self, cx: &mut Context<'_>) -> Poll<()>

Returns Ready when the service has been properly shut down.

Source

pub fn is_shutdown(&self) -> bool

Checks whether pipeline shutdown has been initiated.

Source

pub async fn shutdown(&self)

Shuts down the enclosed service.

Source

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

Returns the current pipeline binding.

The binding can be used to check readiness and call the service.

Trait Implementations§

Source§

impl<Req, Res, Err> Debug for Pipeline<Req, Res, Err>

Source§

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

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

impl<Req, Res, Err> Drop for Pipeline<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<Req, Res, Err> !RefUnwindSafe for Pipeline<Req, Res, Err>

§

impl<Req, Res, Err> !Send for Pipeline<Req, Res, Err>

§

impl<Req, Res, Err> !Sync for Pipeline<Req, Res, Err>

§

impl<Req, Res, Err> !UnwindSafe for Pipeline<Req, Res, Err>

§

impl<Req, Res, Err> Freeze for Pipeline<Req, Res, Err>
where PipelineApi<Req, Res, Err>: Freeze,

§

impl<Req, Res, Err> Unpin for Pipeline<Req, Res, Err>
where PipelineApi<Req, Res, Err>: Unpin,

§

impl<Req, Res, Err> UnsafeUnpin for Pipeline<Req, Res, Err>
where PipelineApi<Req, Res, Err>: 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, 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 = !

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.