pub struct RequestCookies { /* private fields */ }Expand description
Extract all cookies from the incoming request as a map.
Parses the Cookie header and provides access to all cookies by name.
§Example
ⓘ
use fastapi_core::extract::RequestCookies;
async fn handler(cookies: RequestCookies) -> impl IntoResponse {
if let Some(session_id) = cookies.get("session_id") {
format!("Session: {}", session_id)
} else {
"No session".to_string()
}
}Implementations§
Trait Implementations§
Source§impl Clone for RequestCookies
impl Clone for RequestCookies
Source§fn clone(&self) -> RequestCookies
fn clone(&self) -> RequestCookies
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RequestCookies
impl Debug for RequestCookies
Source§impl Default for RequestCookies
impl Default for RequestCookies
Source§fn default() -> RequestCookies
fn default() -> RequestCookies
Returns the “default value” for a type. Read more
Source§impl FromRequest for RequestCookies
impl FromRequest for RequestCookies
Source§type Error = Infallible
type Error = Infallible
Error type when extraction fails.
Source§async fn from_request(
_ctx: &RequestContext,
req: &mut Request,
) -> Result<Self, Self::Error>
async fn from_request( _ctx: &RequestContext, req: &mut Request, ) -> Result<Self, Self::Error>
Extract a value from the request. Read more
Auto Trait Implementations§
impl Freeze for RequestCookies
impl RefUnwindSafe for RequestCookies
impl Send for RequestCookies
impl Sync for RequestCookies
impl Unpin for RequestCookies
impl UnwindSafe for RequestCookies
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
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: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).