Skip to main content

ClientBuilder

Struct 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. Minimum interval is 5 seconds.

Note that granularity of less than a second is not supported and will be ignored.

Source

pub fn buffer_size(self, size: usize) -> Self

Sets the initial size of the internal buffer used for reading data from the TCP socket.

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

pub fn user_agent_extension(self, extension: String) -> Self

Extends the user agent. Intended for library authors.

Source

pub fn compression(self, compression: Compression) -> Self

Sets the compression mode for the read stream. Default is Compression::None.

Source

pub fn slow_reader_behavior( self, slow_reader_behavior: SlowReaderBehavior, ) -> Self

Sets the behavior of the gateway when the client falls behind real time.

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 duplicate 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> UnsafeUnpin for ClientBuilder<AK, D>
where AK: UnsafeUnpin, D: UnsafeUnpin,

§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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>,

Source§

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