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)

Object Safety§

This trait is not object safe.

Implementors§