pub struct Headers(pub HeaderMap);Expand description
Provides access to request headers.
Extracts all HTTP headers from the request.
§Examples
ⓘ
use rapina::prelude::*;
#[get("/auth")]
async fn check_auth(headers: Headers) -> Result<String> {
let auth = headers.get("authorization")
.ok_or_else(|| Error::unauthorized("missing auth header"))?;
Ok("Authenticated".to_string())
}Tuple Fields§
§0: HeaderMapImplementations§
Trait Implementations§
Source§impl FromRequestParts for Headers
impl FromRequestParts for Headers
Source§async fn from_request_parts(
parts: &Parts,
_params: &PathParams,
_state: &Arc<AppState>,
) -> Result<Self, Error>
async fn from_request_parts( parts: &Parts, _params: &PathParams, _state: &Arc<AppState>, ) -> Result<Self, Error>
Extract the value from request parts.
Auto Trait Implementations§
impl Freeze for Headers
impl RefUnwindSafe for Headers
impl Send for Headers
impl Sync for Headers
impl Unpin for Headers
impl UnwindSafe for Headers
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