pub struct Builder { /* private fields */ }
Expand description
A builder for constructing Request
objects.
The Builder
allows setting the HTTP method, version, URL, and headers before
building the final Request
with a body.
Implementations§
source§impl Builder
impl Builder
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Builder
with default values:
GET
methodHTTP/1.1
version- URL set to “/”
- Empty headers
sourcepub fn version_mut(&mut self) -> Option<&mut Version>
pub fn version_mut(&mut self) -> Option<&mut Version>
Returns a mutable reference to the HTTP version.
sourcepub fn method_mut(&mut self) -> Option<&mut Method>
pub fn method_mut(&mut self) -> Option<&mut Method>
Returns a mutable reference to the HTTP method.
sourcepub fn extensions_mut(&mut self) -> Option<&mut Extensions>
pub fn extensions_mut(&mut self) -> Option<&mut Extensions>
Returns a mutable reference to the extensions.
sourcepub fn headers(&self) -> Option<&Headers>
pub fn headers(&self) -> Option<&Headers>
Returns a reference to the headers being set in the Builder
.
sourcepub fn headers_mut(&mut self) -> Option<&mut Headers>
pub fn headers_mut(&mut self) -> Option<&mut Headers>
Returns a mutable reference to the headers being set in the Builder
.
sourcepub fn insert_header<K, V>(self, name: K, value: V) -> Selfwhere
K: TryInto<HeaderName>,
K::Error: Into<InvalidHeaderName>,
V: TryInto<HeaderValue>,
V::Error: Into<InvalidHeaderValue>,
pub fn insert_header<K, V>(self, name: K, value: V) -> Selfwhere
K: TryInto<HeaderName>,
K::Error: Into<InvalidHeaderName>,
V: TryInto<HeaderValue>,
V::Error: Into<InvalidHeaderValue>,
sourcepub fn append_header<K, V>(self, name: K, value: V) -> Selfwhere
K: TryInto<HeaderName>,
K::Error: Into<InvalidHeaderName>,
V: TryInto<HeaderValue>,
V::Error: Into<InvalidHeaderValue>,
pub fn append_header<K, V>(self, name: K, value: V) -> Selfwhere
K: TryInto<HeaderName>,
K::Error: Into<InvalidHeaderName>,
V: TryInto<HeaderValue>,
V::Error: Into<InvalidHeaderValue>,
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl !RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
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