pub struct AcceptHeader(pub Option<String>);Expand description
Extracts the Accept header value from the request.
Use this in handler arguments to pass into NegotiatedResponse::new.
§Example
ⓘ
use typeway_server::negotiate::*;
async fn handler(accept: AcceptHeader) -> NegotiatedResponse<MyType, (JsonFormat, TextFormat)> {
NegotiatedResponse::new(my_value, accept.0)
}Tuple Fields§
§0: Option<String>Trait Implementations§
Source§impl FromRequestParts for AcceptHeader
impl FromRequestParts for AcceptHeader
Source§type Error = Infallible
type Error = Infallible
The error type returned when extraction fails.
Auto Trait Implementations§
impl Freeze for AcceptHeader
impl RefUnwindSafe for AcceptHeader
impl Send for AcceptHeader
impl Sync for AcceptHeader
impl Unpin for AcceptHeader
impl UnsafeUnpin for AcceptHeader
impl UnwindSafe for AcceptHeader
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