pub struct RequestOptions {
pub max_body: Option<usize>,
pub extensions: Extensions,
pub headers: HeaderMap,
}Expand description
Options every call made through one client value carries: a generated client’s with_options
sets them on the client value it returns, so a call that needs its own derives a client for it
(client.clone().with_options(options)) rather than sharing mutable state with other calls.
They are read each time the runtime’s send or send_streaming sends a request, after the
request is built and its credentials attached.
Fields§
§max_body: Option<usize>Maximum bytes of a response body a non-streaming operation reads before it fails with
Error::BodyTooLarge; None (the default) leaves ClientConfig::max_success_body in
force.
On a success body it replaces ClientConfig::max_success_body, and bounds the read as
that field describes: a Content-Length past it is refused before the body is read (unless
the response carries no body, as that field says), and a
body that grows past it is abandoned at the chunk that crosses it. An error body is read no
further than ClientConfig::max_error_body in any case; where this limit is the smaller
of the two, an error body past it fails with Error::BodyTooLarge the same way, instead
of being truncated. An operation returning an EventStream is exempt, success and error
body alike: ClientConfig::max_stream_frame bounds its items.
extensions: ExtensionsExtensions copied onto each request this client value sends, where an
HttpBackend reads them from the http::Request it executes. An extension of a type the
request already carries is left as the request has it. A super::TotalTimeout here is
the call’s deadline: it replaces ClientConfig::timeout on a non-streaming operation,
and, being asked for explicitly, also bounds an operation returning an EventStream,
which the configured timeout leaves unbounded.
headers: HeaderMapHeaders added to each request this client value sends, every operation’s included. A
header the request already carries — an operation’s own header parameter, its content
type, or an attached credential — is left as the request has it, and every value of a name
the request lacks is added. ClientCore’s Debug prints them; mark a secret one with
HeaderValue::set_sensitive to redact it there.
Trait Implementations§
Source§impl Clone for RequestOptions
impl Clone for RequestOptions
Source§fn clone(&self) -> RequestOptions
fn clone(&self) -> RequestOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RequestOptions
impl Debug for RequestOptions
Source§impl Default for RequestOptions
impl Default for RequestOptions
Source§fn default() -> RequestOptions
fn default() -> RequestOptions
Auto Trait Implementations§
impl !RefUnwindSafe for RequestOptions
impl !UnwindSafe for RequestOptions
impl Freeze for RequestOptions
impl Send for RequestOptions
impl Sync for RequestOptions
impl Unpin for RequestOptions
impl UnsafeUnpin for RequestOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more