Trait ValidBuilder

Source
pub trait ValidBuilder {
    // Required methods
    fn new() -> Self;
    fn build(&self) -> Result<Request, BuilderError>;
    fn host(&mut self, host: String) -> &mut Self;
    fn port(&mut self, port: u16) -> &mut Self;
    fn http_version(&mut self, http_version: String) -> &mut Self;
    fn method(&mut self, method: String) -> &mut Self;
    fn path(&mut self, path: String) -> &mut Self;
    fn header(&mut self, key: String, value: String) -> &mut Self;
    fn body(&mut self, body: String) -> &mut Self;
    fn uri(&mut self, uri: String) -> &mut Self;
}
Expand description

Describes the request builder

Required Methods§

Source

fn new() -> Self

Create a new builder

Source

fn build(&self) -> Result<Request, BuilderError>

Build the request from the builder

Source

fn host(&mut self, host: String) -> &mut Self

Set the host of the request (example: httpbin.org)

Source

fn port(&mut self, port: u16) -> &mut Self

Set the port of the request (example: 80)

Source

fn http_version(&mut self, http_version: String) -> &mut Self

Set the HTTP version of the request (example: 1.1)

Source

fn method(&mut self, method: String) -> &mut Self

Set the method of the request (example: GET)

Source

fn path(&mut self, path: String) -> &mut Self

Set the path of the request (example: /post)

Source

fn header(&mut self, key: String, value: String) -> &mut Self

Set a header of the request (example: Content-Type, application/json)

Source

fn body(&mut self, body: String) -> &mut Self

Set the body of the request (example: {“name”: “John”})

Source

fn uri(&mut self, uri: String) -> &mut Self

Set the URI of the request (example: http://httpbin.org/post?name=bob)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§