Struct awc::Client [−][src]
pub struct Client(_);
Expand description
An asynchronous HTTP and WebSocket client.
Examples
use awc::Client;
#[actix_rt::main]
async fn main() {
let mut client = Client::default();
let res = client.get("http://www.rust-lang.org") // <- Create request builder
.header("User-Agent", "Actix-web")
.send() // <- Send http request
.await; // <- send request and wait for response
println!("Response: {:?}", res);
}
Implementations
Create Client
builder.
This function is equivalent of ClientBuilder::new()
.
Construct HTTP request.
pub fn request_from<U>(&self, url: U, head: &RequestHead) -> ClientRequest where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<HttpError>,
pub fn request_from<U>(&self, url: U, head: &RequestHead) -> ClientRequest where
Uri: TryFrom<U>,
<Uri as TryFrom<U>>::Error: Into<HttpError>,
Create ClientRequest
from RequestHead
It is useful for proxy requests. This implementation copies all headers and the method.
Construct HTTP GET request.
Construct HTTP HEAD request.
Construct HTTP PUT request.
Construct HTTP POST request.
Construct HTTP PATCH request.
Construct HTTP DELETE request.
Construct HTTP OPTIONS request.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more