pub struct MiddlewareOptions {
pub types: Vec<String>,
pub order: i32,
pub when: When,
}Expand description
What a middleware checks: MiddlewareOptions::new(&["shop.*"]), with
MiddlewareOptions { order: 5, ..MiddlewareOptions::new(&["*"]) } for another order and
.after() to run after requests.
Fields§
§types: Vec<String>Command and query types: * (all), a type of the listener’s domain (Place), of another
domain (orders.Place) or a whole domain (orders.*). File and cache requests are
types too: PutData, GetData, DeleteData, ListData, SetCache, GetCache,
DeleteCache
(e.g. shop.PutData); * and orders.* cover them.
order: i32Position in the chain: lower runs first, equal orders by listener name (default 0).
Negative orders are reserved for kernable’s kits (a grant of reserved_order).
when: WhenBefore (default) or after requests; see When.
Implementations§
Source§impl MiddlewareOptions
impl MiddlewareOptions
Sourcepub fn new(types: &[&str]) -> MiddlewareOptions
pub fn new(types: &[&str]) -> MiddlewareOptions
Checks types (see MiddlewareOptions::types) before requests, at order 0.
Sourcepub fn after(self) -> MiddlewareOptions
pub fn after(self) -> MiddlewareOptions
Runs after requests instead of before: the handler gets their outcome too.
Trait Implementations§
Source§impl Clone for MiddlewareOptions
impl Clone for MiddlewareOptions
Auto Trait Implementations§
impl Forget for MiddlewareOptions
impl Freeze for MiddlewareOptions
impl Move for MiddlewareOptions
impl RefUnwindSafe for MiddlewareOptions
impl Send for MiddlewareOptionswhere
RawVecInner: Send,
impl Sync for MiddlewareOptionswhere
RawVecInner: Sync,
impl Unpin for MiddlewareOptions
impl UnsafeUnpin for MiddlewareOptions
impl UnwindSafe for MiddlewareOptionswhere
RawVecInner: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request