Skip to main content

Plugin

Struct Plugin 

Source
pub struct Plugin { /* private fields */ }
Expand description

A lexical provider scope containing operations and nested plugins.

Implementations§

Source§

impl Plugin

Source

pub fn new(name: impl Into<String>) -> Self

Source

pub fn provide(self, provider: Provider) -> Self

Source

pub fn security_scheme(self, scheme: SecuritySchemeDescriptor) -> Self

Registers an application security scheme from this plugin scope.

Source

pub fn operation(self, operation: ExecutableOperation) -> Self

Source

pub fn routes( self, operations: impl IntoIterator<Item = ExecutableOperation>, ) -> Self

Source

pub fn plugin(self, plugin: Self) -> Self

Source

pub fn on_request<Hook, HookFuture>(self, hook: Hook) -> Self
where Hook: Fn(HookContext) -> HookFuture + 'static, HookFuture: Future<Output = Result<(), DependencyError>> + 'static,

Adds a fallible async hook that runs before dependency resolution.

Source

pub fn pre_parse<Hook, HookFuture>(self, hook: Hook) -> Self
where Hook: Fn(HookContext) -> HookFuture + 'static, HookFuture: Future<Output = Result<(), DependencyError>> + 'static,

Adds a fallible async hook before typed input extraction begins.

Source

pub fn pre_validate<Hook, HookFuture>(self, hook: Hook) -> Self
where Hook: Fn(HookContext) -> HookFuture + 'static, HookFuture: Future<Output = Result<(), DependencyError>> + 'static,

Adds a fallible async hook immediately before input validation.

Source

pub fn pre_handler<Hook, HookFuture>(self, hook: Hook) -> Self
where 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.

Source

pub fn pre_serialize<Hook, HookFuture>(self, hook: Hook) -> Self
where Hook: Fn(HookContext) -> HookFuture + 'static, HookFuture: Future<Output = Result<(), DependencyError>> + 'static,

Adds a fallible async hook after the handler and before transport response projection.

Source

pub fn on_error<Hook, HookFuture>(self, hook: Hook) -> Self
where Hook: Fn(HookContext, HookOutcome) -> HookFuture + 'static, HookFuture: Future<Output = ()> + 'static,

Adds an async observer for rejected, domain-error, and internal-error outcomes.

Source

pub fn on_response<Hook, HookFuture>(self, hook: Hook) -> Self
where Hook: Fn(HookContext, HookOutcome) -> HookFuture + 'static, HookFuture: Future<Output = ()> + 'static,

Adds an async observer that runs after the handler and DI finalizers.

Source

pub fn on_startup<Hook, HookFuture>(self, hook: Hook) -> Self
where 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.

Source

pub fn on_shutdown<Hook, HookFuture>(self, hook: Hook) -> Self
where 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.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Plugin

§

impl !Send for Plugin

§

impl !Sync for Plugin

§

impl !UnwindSafe for Plugin

§

impl Freeze for Plugin

§

impl Unpin for Plugin

§

impl UnsafeUnpin for Plugin

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> BackgroundExt for T

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> ResponseExt for T

Source§

fn header( self, name: impl Into<String>, value: impl Into<String>, ) -> WithHeaders<Self>

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.