pub struct Operation<S, L = Identity> {
    pub inner: S,
    pub layer: L,
}
Expand description

A Smithy operation, represented by a Service S and a Layer L.

The L is held and applied lazily during Upgradable::upgrade.

Fields§

§inner: S

The inner Service representing the logic of the operation.

§layer: L

The Layer applied to the HTTP Service after S has been wrapped in Upgrade.

Implementations§

source§

impl<S, L> Operation<S, L>

source

pub fn layer<NewL>(self, layer: NewL) -> Operation<S, Stack<L, NewL>>

Applies a Layer to the operation after it has been upgraded via Operation::upgrade.

source§

impl<Op, S, PollError> Operation<Normalize<Op, S, PollError>>

source

pub fn from_service<Exts>(inner: S) -> Selfwhere Op: OperationShape, S: OperationService<Op, Exts, PollError>,

Creates an Operation from a Service.

source§

impl<Op, H> Operation<IntoService<Op, H>>

source

pub fn from_handler<Exts>(handler: H) -> Selfwhere Op: OperationShape, H: Handler<Op, Exts>,

Creates an Operation from a Handler.

Trait Implementations§

source§

impl<P, Op, Exts, B, Pl, S, L, PollError> Upgradable<P, Op, Exts, B, Pl> for Operation<S, L>where Op: OperationShape, Op::Input: FromRequest<P, B>, Op::Output: IntoResponse<P>, Op::Error: IntoResponse<P>, Exts: FromParts<P>, Pl::Service: Service<(Op::Input, Exts), Response = Op::Output, Error = OperationError<Op::Error, PollError>> + Clone, Pl: Plugin<P, Op, S, L>, Pl::Layer: Layer<Upgrade<P, Op, Exts, Pl::Service>>, <<Pl as Plugin<P, Op, S, L>>::Layer as Layer<Upgrade<P, Op, Exts, <Pl as Plugin<P, Op, S, L>>::Service>>>::Service: Service<Request<B>, Response = Response<BoxBody>, Error = Infallible> + Clone + Send + 'static, <<<Pl as Plugin<P, Op, S, L>>::Layer as Layer<Upgrade<P, Op, Exts, <Pl as Plugin<P, Op, S, L>>::Service>>>::Service as Service<Request<B>>>::Future: Send + 'static,

source§

fn upgrade(self, plugin: &Pl) -> Route<B>

Takes the Operation<S, L>, applies Plugin, then applies UpgradeLayer to the modified S, then finally applies the modified L.

The composition is made explicit in the method constraints and return type.

Auto Trait Implementations§

§

impl<S, L> RefUnwindSafe for Operation<S, L>where L: RefUnwindSafe, S: RefUnwindSafe,

§

impl<S, L> Send for Operation<S, L>where L: Send, S: Send,

§

impl<S, L> Sync for Operation<S, L>where L: Sync, S: Sync,

§

impl<S, L> Unpin for Operation<S, L>where L: Unpin, S: Unpin,

§

impl<S, L> UnwindSafe for Operation<S, L>where L: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

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