pub struct ClientBuilder { /* private fields */ }
Expand description
ClientBuilder provides a series of builder methods to easily construct a Client
.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn for_url(url: &str) -> Result<ClientBuilder>
pub fn for_url(url: &str) -> Result<ClientBuilder>
Create a builder for a given URL.
Sourcepub fn method(self, method: String) -> ClientBuilder
pub fn method(self, method: String) -> ClientBuilder
Set the request method used for the initial connection to the SSE endpoint.
Sourcepub fn body(self, body: String) -> ClientBuilder
pub fn body(self, body: String) -> ClientBuilder
Set the request body used for the initial connection to the SSE endpoint.
Sourcepub fn last_event_id(self, last_event_id: String) -> ClientBuilder
pub fn last_event_id(self, last_event_id: String) -> ClientBuilder
Set the last event id for a stream when it is created. If it is set, it will be sent to the server in case it can replay missed events.
Sourcepub fn header(self, name: &str, value: &str) -> Result<ClientBuilder>
pub fn header(self, name: &str, value: &str) -> Result<ClientBuilder>
Set a HTTP header on the SSE request.
Sourcepub fn read_timeout(self, read_timeout: Duration) -> ClientBuilder
pub fn read_timeout(self, read_timeout: Duration) -> ClientBuilder
Set a read timeout for the underlying connection. There is no read timeout by default.
Sourcepub fn reconnect(self, opts: ReconnectOptions) -> ClientBuilder
pub fn reconnect(self, opts: ReconnectOptions) -> ClientBuilder
Configure the client’s reconnect behaviour according to the supplied
ReconnectOptions
.
Sourcepub fn redirect_limit(self, limit: u32) -> ClientBuilder
pub fn redirect_limit(self, limit: u32) -> ClientBuilder
Customize the client’s following behavior when served a redirect.
To disable following redirects, pass 0
.
By default, the limit is DEFAULT_REDIRECT_LIMIT
.
Sourcepub fn build_with_conn<C>(self, conn: C) -> impl Client
pub fn build_with_conn<C>(self, conn: C) -> impl Client
Build with a specific client connector.
Sourcepub fn build_http(self) -> impl Client
pub fn build_http(self) -> impl Client
Build with an HTTP client connector.
Sourcepub fn build(self) -> impl Client
pub fn build(self) -> impl Client
Build with an HTTPS client connector, using the OS root certificate store.
Sourcepub fn build_with_http_client<C>(self, http: Client<C>) -> impl Client
pub fn build_with_http_client<C>(self, http: Client<C>) -> impl Client
Build with the given hyper::client::Client
.