Struct databento::live::ClientBuilder

source ·
pub struct ClientBuilder<AK, D> { /* private fields */ }
Available on crate feature 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>

source

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.

source

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.

source

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.

source

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>

source

pub fn new() -> Self

Creates a new ClientBuilder.

source§

impl<D> ClientBuilder<Unset, D>

source

pub fn key(self, key: impl ToString) -> Result<ClientBuilder<ApiKey, D>>

Sets the API key.

§Errors

This function returns an error when the API key is invalid.

source

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>

source

pub fn dataset(self, dataset: impl ToString) -> ClientBuilder<AK, String>

Sets the dataset.

source§

impl ClientBuilder<ApiKey, String>

source

pub async fn build(self) -> Result<Client>

Initializes the client and attempts to connect to the gateway.

§Errors

This function returns an error when its unable to connect and authenticate with the Live gateway.

Trait Implementations§

source§

impl<AK: Clone, D: Clone> Clone for ClientBuilder<AK, D>

source§

fn clone(&self) -> ClientBuilder<AK, D>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<AK: Debug, D: Debug> Debug for ClientBuilder<AK, D>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<AK, D> Freeze for ClientBuilder<AK, D>
where AK: Freeze, D: Freeze,

§

impl<AK, D> RefUnwindSafe for ClientBuilder<AK, D>

§

impl<AK, D> Send for ClientBuilder<AK, D>
where AK: Send, D: Send,

§

impl<AK, D> Sync for ClientBuilder<AK, D>
where AK: Sync, D: Sync,

§

impl<AK, D> Unpin for ClientBuilder<AK, D>
where AK: Unpin, D: Unpin,

§

impl<AK, D> UnwindSafe for ClientBuilder<AK, D>
where AK: UnwindSafe, D: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T