pub struct Plugin { /* private fields */ }Expand description
A lexical provider scope containing operations and nested plugins.
Implementations§
Source§impl Plugin
impl Plugin
pub fn new(name: impl Into<String>) -> Self
pub fn provide(self, provider: Provider) -> Self
Sourcepub fn security_scheme(self, scheme: SecuritySchemeDescriptor) -> Self
pub fn security_scheme(self, scheme: SecuritySchemeDescriptor) -> Self
Registers an application security scheme from this plugin scope.
pub fn operation(self, operation: ExecutableOperation) -> Self
pub fn routes( self, operations: impl IntoIterator<Item = ExecutableOperation>, ) -> Self
pub fn plugin(self, plugin: Self) -> Self
Sourcepub fn on_request<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext) -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
pub fn on_request<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext) -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
Adds a fallible async hook that runs before dependency resolution.
Sourcepub fn pre_parse<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext) -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
pub fn pre_parse<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext) -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
Adds a fallible async hook before typed input extraction begins.
Sourcepub fn pre_validate<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext) -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
pub fn pre_validate<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext) -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
Adds a fallible async hook immediately before input validation.
Sourcepub fn pre_handler<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext) -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
pub fn pre_handler<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext) -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
Adds a fallible async hook after input preparation and before the user handler future is polled.
Sourcepub fn pre_serialize<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext) -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
pub fn pre_serialize<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext) -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
Adds a fallible async hook after the handler and before transport response projection.
Sourcepub fn on_error<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext, HookOutcome) -> HookFuture + 'static,
HookFuture: Future<Output = ()> + 'static,
pub fn on_error<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext, HookOutcome) -> HookFuture + 'static,
HookFuture: Future<Output = ()> + 'static,
Adds an async observer for rejected, domain-error, and internal-error outcomes.
Sourcepub fn on_response<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext, HookOutcome) -> HookFuture + 'static,
HookFuture: Future<Output = ()> + 'static,
pub fn on_response<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn(HookContext, HookOutcome) -> HookFuture + 'static,
HookFuture: Future<Output = ()> + 'static,
Adds an async observer that runs after the handler and DI finalizers.
Sourcepub fn on_startup<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn() -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
pub fn on_startup<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn() -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
Adds a fallible async application startup hook.
Startup executes parent hooks before child hooks. A failure stops startup before the server accepts requests.
Sourcepub fn on_shutdown<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn() -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
pub fn on_shutdown<Hook, HookFuture>(self, hook: Hook) -> Selfwhere
Hook: Fn() -> HookFuture + 'static,
HookFuture: Future<Output = Result<(), DependencyError>> + 'static,
Adds a fallible async application shutdown hook.
Shutdown executes child hooks before parent hooks and continues after a failure so every registered cleanup receives a chance to run.