pub struct ClientRequest { /* private fields */ }Expand description
Outbound HTTP request (apps build this; clients send it).
Implementations§
Source§impl ClientRequest
impl ClientRequest
Sourcepub fn get(url: impl Into<String>) -> ClientRequest
pub fn get(url: impl Into<String>) -> ClientRequest
Starts a GET request.
Sourcepub fn post(url: impl Into<String>) -> ClientRequest
pub fn post(url: impl Into<String>) -> ClientRequest
Starts a POST request.
Sourcepub fn put(url: impl Into<String>) -> ClientRequest
pub fn put(url: impl Into<String>) -> ClientRequest
Starts a PUT request.
Sourcepub fn patch(url: impl Into<String>) -> ClientRequest
pub fn patch(url: impl Into<String>) -> ClientRequest
Starts a PATCH request.
Sourcepub fn delete(url: impl Into<String>) -> ClientRequest
pub fn delete(url: impl Into<String>) -> ClientRequest
Starts a DELETE request.
Sourcepub fn head(url: impl Into<String>) -> ClientRequest
pub fn head(url: impl Into<String>) -> ClientRequest
Starts a HEAD request.
Sourcepub fn new(method: ClientMethod, url: impl Into<String>) -> ClientRequest
pub fn new(method: ClientMethod, url: impl Into<String>) -> ClientRequest
Builds a request with method and URL.
Sourcepub fn header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> ClientRequest
pub fn header( self, name: impl Into<String>, value: impl Into<String>, ) -> ClientRequest
Sets a header (name stored lowercased).
Sourcepub fn body_text(self, text: impl Into<String>) -> ClientRequest
pub fn body_text(self, text: impl Into<String>) -> ClientRequest
Sets a UTF-8 body and content-type: text/plain; charset=utf-8 when absent.
Sourcepub const fn timeout(self, timeout: Duration) -> ClientRequest
pub const fn timeout(self, timeout: Duration) -> ClientRequest
Per-request timeout (overrides the client default when set).
Sourcepub const fn method(&self) -> ClientMethod
pub const fn method(&self) -> ClientMethod
HTTP method.
Sourcepub fn body_bytes(&self) -> &[u8] ⓘ
pub fn body_bytes(&self) -> &[u8] ⓘ
Body bytes.
Sourcepub const fn timeout_duration(&self) -> Option<Duration>
pub const fn timeout_duration(&self) -> Option<Duration>
Optional timeout.
Trait Implementations§
Source§impl Clone for ClientRequest
impl Clone for ClientRequest
Source§fn clone(&self) -> ClientRequest
fn clone(&self) -> ClientRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ClientRequest
impl Debug for ClientRequest
impl Eq for ClientRequest
Source§impl PartialEq for ClientRequest
impl PartialEq for ClientRequest
impl StructuralPartialEq for ClientRequest
Auto Trait Implementations§
impl Forget for ClientRequest
impl Freeze for ClientRequest
impl Move for ClientRequest
impl RefUnwindSafe for ClientRequest
impl Send for ClientRequest
impl Sync for ClientRequest
impl Unpin for ClientRequest
impl UnsafeUnpin for ClientRequest
impl UnwindSafe for ClientRequest
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> 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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.