Struct databento::live::ClientBuilder
source · pub struct ClientBuilder<AK, D> { /* private fields */ }
live
only.Expand description
A type-safe builder for the LiveClient
. It will not allow you to call
Self::build()
before setting the required fields:
key
dataset
Implementations§
source§impl<AK, D> ClientBuilder<AK, D>
impl<AK, D> ClientBuilder<AK, D>
sourcepub fn send_ts_out(self, send_ts_out: bool) -> Self
pub fn send_ts_out(self, send_ts_out: bool) -> Self
Sets ts_out
, which when enabled instructs the gateway to send a send timestamp
after every record. These can be decoded with the special WithTsOut
type.
sourcepub fn upgrade_policy(self, upgrade_policy: VersionUpgradePolicy) -> Self
pub fn upgrade_policy(self, upgrade_policy: VersionUpgradePolicy) -> Self
Sets upgrade_policy
, which controls how to decode data from prior DBN
versions. The current default is to upgrade them to the latest version while
decoding.
sourcepub fn heartbeat_interval(self, heartbeat_interval: Duration) -> Self
pub fn heartbeat_interval(self, heartbeat_interval: Duration) -> Self
Sets heartbeat_interval
, which controls the interval at which the gateway
will send heartbeat records if no other data records are sent. If no heartbeat
interval is configured, the gateway default will be used.
Note that granularity of less than a second is not supported and will be ignored.
sourcepub async fn addr(self, addr: impl ToSocketAddrs) -> Result<Self>
pub async fn addr(self, addr: impl ToSocketAddrs) -> Result<Self>
Overrides the address of the gateway the client will connect to. This is an advanced method.
§Errors
This function returns an error when addr
fails to resolve.
source§impl ClientBuilder<Unset, Unset>
impl ClientBuilder<Unset, Unset>
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ClientBuilder
.
source§impl<D> ClientBuilder<Unset, D>
impl<D> ClientBuilder<Unset, D>
sourcepub fn key_from_env(self) -> Result<ClientBuilder<ApiKey, D>>
pub fn key_from_env(self) -> Result<ClientBuilder<ApiKey, D>>
Sets the API key reading it from the DATABENTO_API_KEY
environment
variable.
§Errors
This function returns an error when the environment variable is not set or the API key is invalid.
source§impl<AK> ClientBuilder<AK, Unset>
impl<AK> ClientBuilder<AK, Unset>
sourcepub fn dataset(self, dataset: impl ToString) -> ClientBuilder<AK, String>
pub fn dataset(self, dataset: impl ToString) -> ClientBuilder<AK, String>
Sets the dataset.