Struct actix_web::guard::GuardContext
source · [−]pub struct GuardContext<'a> { /* private fields */ }
Expand description
Provides access to request parts that are useful during routing.
Implementations
Returns reference to the request head.
Returns reference to the request-local data/extensions container.
Returns mutable reference to the request-local data/extensions container.
Extracts a typed header from the request.
Returns None
if parsing H
fails.
Examples
use actix_web::{guard::fn_guard, http::header};
let image_accept_guard = fn_guard(|ctx| {
match ctx.header::<header::Accept>() {
Some(hdr) => hdr.preference() == "image/*",
None => false,
}
});
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for GuardContext<'a>
impl<'a> !Send for GuardContext<'a>
impl<'a> !Sync for GuardContext<'a>
impl<'a> Unpin for GuardContext<'a>
impl<'a> !UnwindSafe for GuardContext<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more