Struct restest::request::RequestBuilder[][src]

pub struct RequestBuilder { /* fields omitted */ }
Expand description

Allows encode metadata in order to create a Request.

This type can be created by calling either Request::get or Request::post. Specifically, this type allows to encode the request header with RequestBuilder::with_header, and to create the final Request type by calling RequestBuilder::with_body.

This allows to create Request types, as shown in the following example:

use restest::Request;

use serde::Serialize;

let request = Request::get("user")
    .with_header("token", "mom-said-yes")
    .with_body(GetUserRequest {
        login: String::from("jdoe")
    });

#[derive(Serialize)]
struct GetUserRequest {
    login: String,
}

Implementations

Adds a header key and value to the request.

Specifies a body, returns the final Request object.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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