pub struct Builder<AsyncMode> { /* private fields */ }
Expand description
Builder for a BlockingClient
or an AsyncClient
.
Implementations§
source§impl<AsyncMode> Builder<AsyncMode>
impl<AsyncMode> Builder<AsyncMode>
sourcepub fn with_runtime(self, handle: Handle) -> Builder<AsyncMode>
pub fn with_runtime(self, handle: Handle) -> Builder<AsyncMode>
Specifies the tokio runtime this client should use for its async tasks.
If not specified, Client
will try to acquire a handle via
tokio::runtime::Handle::try_current()
.
sourcepub fn with_api<Api>(self) -> Builder<AsyncMode>where
Api: Api,
pub fn with_api<Api>(self) -> Builder<AsyncMode>where
Api: Api,
Enables using a Api
with this client. If you want to
receive out-of-band API requests, set a callback using
with_custom_api_callback
instead.
sourcepub fn with_api_callback<Api>(
self,
callback: ApiCallback<Api>
) -> Builder<AsyncMode>where
Api: Api,
pub fn with_api_callback<Api>(
self,
callback: ApiCallback<Api>
) -> Builder<AsyncMode>where
Api: Api,
Enables using a Api
with this client. callback
will be
invoked when custom API responses are received from the server.
sourcepub fn with_certificate(self, certificate: Certificate) -> Builder<AsyncMode>
pub fn with_certificate(self, certificate: Certificate) -> Builder<AsyncMode>
Connects to a server using a pinned certificate
. Only supported with BonsaiDb protocol-based connections.
sourcepub fn with_protocol_version(self, version: &'static str) -> Builder<AsyncMode>
pub fn with_protocol_version(self, version: &'static str) -> Builder<AsyncMode>
Overrides the protocol version. Only for testing purposes.
sourcepub fn with_request_timeout(
self,
timeout: impl Into<Duration>
) -> Builder<AsyncMode>
pub fn with_request_timeout( self, timeout: impl Into<Duration> ) -> Builder<AsyncMode>
Sets the request timeout for the client.
If not specified, requests will time out after 60 seconds.
sourcepub fn with_connect_timeout(
self,
timeout: impl Into<Duration>
) -> Builder<AsyncMode>
pub fn with_connect_timeout( self, timeout: impl Into<Duration> ) -> Builder<AsyncMode>
Sets the connection timeout for the client.
If not specified, the client will time out after 60 seconds if a connection cannot be established.