pub struct ModelPlugins<P>(/* private fields */);Expand description
A wrapper struct for composing model plugins.
It operates identically to HttpPlugins; see its documentation.
Implementations§
Source§impl ModelPlugins<IdentityPlugin>
impl ModelPlugins<IdentityPlugin>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty ModelPlugins.
You can use ModelPlugins::push to add plugins to it.
Source§impl<P> ModelPlugins<P>
impl<P> ModelPlugins<P>
Sourcepub fn push<NewPlugin: ModelMarker>(
self,
new_plugin: NewPlugin,
) -> ModelPlugins<PluginStack<NewPlugin, P>>
pub fn push<NewPlugin: ModelMarker>( self, new_plugin: NewPlugin, ) -> ModelPlugins<PluginStack<NewPlugin, P>>
Apply a new model plugin after the ones that have already been registered.
use aws_smithy_http_server::plugin::ModelPlugins;
let model_plugins = ModelPlugins::new().push(LoggingPlugin).push(MetricsPlugin);The plugins’ runtime logic is executed in registration order.
In our example above, LoggingPlugin would run first, while MetricsPlugin is executed last.
§Implementation notes
Plugins are applied to the underlying Service in opposite order compared
to their registration order.
As an example:
ⓘ
#[derive(Debug)]
pub struct PrintPlugin;
impl<Ser, Op, S> Plugin<Ser, Op, T> for PrintPlugin
// [...]
{
// [...]
fn apply(&self, inner: T) -> Self::Service {
PrintService {
inner,
service_id: Ser::ID,
operation_id: Op::ID
}
}
}Sourcepub fn layer<L>(self, layer: L) -> ModelPlugins<PluginStack<LayerPlugin<L>, P>>
pub fn layer<L>(self, layer: L) -> ModelPlugins<PluginStack<LayerPlugin<L>, P>>
Applies a single [tower::Layer] to all operations before they are deserialized.
Trait Implementations§
Source§impl<P: Debug> Debug for ModelPlugins<P>
impl<P: Debug> Debug for ModelPlugins<P>
Source§impl Default for ModelPlugins<IdentityPlugin>
impl Default for ModelPlugins<IdentityPlugin>
Source§impl<Ser, Op, T, InnerPlugin> Plugin<Ser, Op, T> for ModelPlugins<InnerPlugin>where
InnerPlugin: Plugin<Ser, Op, T>,
impl<Ser, Op, T, InnerPlugin> Plugin<Ser, Op, T> for ModelPlugins<InnerPlugin>where
InnerPlugin: Plugin<Ser, Op, T>,
impl<InnerPlugin> ModelMarker for ModelPlugins<InnerPlugin>where
InnerPlugin: ModelMarker,
Auto Trait Implementations§
impl<P> Freeze for ModelPlugins<P>where
P: Freeze,
impl<P> RefUnwindSafe for ModelPlugins<P>where
P: RefUnwindSafe,
impl<P> Send for ModelPlugins<P>where
P: Send,
impl<P> Sync for ModelPlugins<P>where
P: Sync,
impl<P> Unpin for ModelPlugins<P>where
P: Unpin,
impl<P> UnwindSafe for ModelPlugins<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.