pub struct ClientBuilder(/* private fields */);Expand description
Builder to create a Client.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn new(service_url: impl IntoUrl) -> Self
pub fn new(service_url: impl IntoUrl) -> Self
Creates a new ClientBuilder, configured with the given service_url.
To perform CRUD operations, one has to create a Client, and then scope it to a Usecase
and Scope in order to create a Session.
Sourcepub fn propagate_traces(self, propagate_traces: bool) -> Self
pub fn propagate_traces(self, propagate_traces: bool) -> Self
Changes whether the sentry-trace header will be sent to Objectstore
to take advantage of Sentry’s distributed tracing.
By default, tracing headers will not be propagated.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Sets both the connect and the read timeout for the [reqwest::Client].
For more fine-grained configuration, use Self::configure_reqwest.
By default, a connect and read timeout of 500ms is set.
Sourcepub fn configure_reqwest<F>(self, closure: F) -> Selfwhere
F: FnOnce(ClientBuilder) -> ClientBuilder,
pub fn configure_reqwest<F>(self, closure: F) -> Selfwhere
F: FnOnce(ClientBuilder) -> ClientBuilder,
Calls the closure with the underlying [reqwest::ClientBuilder].
By default, the ClientBuilder is configured to create a reqwest Client with a connect and read timeout of 500ms and a user agent identifying this library.
Sourcepub fn build(self) -> Result<Client>
pub fn build(self) -> Result<Client>
Returns a Client that uses this ClientBuilder configuration.
§Errors
This method fails if:
- the given
service_urlis invalid or cannot be used as a base URL - the [
reqwest::Client] fails to build. Refer to [reqwest::ClientBuilder::build] for more information on when this can happen.