pub struct PreferDirectives {
pub code: Option<u16>,
pub example: Option<String>,
pub media_type: Option<String>,
pub dynamic: bool,
}Expand description
Directives extracted from the Prefer and Accept request headers.
Fields§
§code: Option<u16>Desired HTTP status code (Prefer: code=404).
example: Option<String>Desired named example (Prefer: example=notFound).
media_type: Option<String>Desired media type from Accept header.
dynamic: boolWhether dynamic faker mode was requested (Prefer: dynamic=true).
Implementations§
Source§impl PreferDirectives
impl PreferDirectives
Sourcepub fn from_headers(headers: &HeaderMap) -> Self
pub fn from_headers(headers: &HeaderMap) -> Self
Parse directives from HTTP request headers.
Recognizes:
Prefer: code=<status>— select a response by status codePrefer: example=<name>— select a named examplePrefer: dynamic=true— force faker-generated dynamic dataAcceptheader — preferred response media type
Trait Implementations§
Source§impl Clone for PreferDirectives
impl Clone for PreferDirectives
Source§fn clone(&self) -> PreferDirectives
fn clone(&self) -> PreferDirectives
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 PreferDirectives
impl Debug for PreferDirectives
Source§impl Default for PreferDirectives
impl Default for PreferDirectives
Source§fn default() -> PreferDirectives
fn default() -> PreferDirectives
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PreferDirectives
impl RefUnwindSafe for PreferDirectives
impl Send for PreferDirectives
impl Sync for PreferDirectives
impl Unpin for PreferDirectives
impl UnsafeUnpin for PreferDirectives
impl UnwindSafe for PreferDirectives
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: 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>
Wrap the input message
T in a tonic::Request