Struct RqliteClientBuilder

Source
pub struct RqliteClientBuilder { /* private fields */ }
Expand description

A builder for creating a RqliteClient.

Implementations§

Source§

impl RqliteClientBuilder

Source

pub fn new() -> Self

Creates a new RqliteClientBuilder.

Source

pub fn auth(self, user: &str, password: &str) -> Self

Adds basic auth credentials

Source

pub fn known_host(self, host: impl ToString) -> Self

Adds a known host to the builder. It is important not to add the scheme to the host. The scheme is set using the scheme method. The host should be in the format hostname:port. For example, localhost:4001.

Source

pub fn default_query_params(self, params: Vec<RqliteQueryParam>) -> Self

Adds a default query parameter to the builder. The blob_array parameter is added by default if the fast-blob feature is not enabled. (see https://rqlite.io/docs/api/api/#blob-data)

Source

pub fn fallback_count(self, count: FallbackCount) -> Self

Sets the fallback count for the client. The fallback count is the number of times the client will try to switch to another host if the current host fails.

Source

pub fn fallback_strategy( self, strategy: impl FallbackStrategy + 'static, ) -> Self

Sets the fallback strategy for the client. The fallback strategy is the strategy used to switch to another host if the current host fails. The default strategy is RoundRobin.

Source

pub fn fallback_persistence(self, persist: bool) -> Self

Sets the fallback persistence for the client. If set to true, which is the default, the client will keep using the last host that was successful. If set to false, the client will always try the first host in the list.

Source

pub fn scheme(self, scheme: Scheme) -> Self

Sets the scheme for the client.

Source

pub fn build(self) -> Result<RqliteClient, ClientBuilderError>

Builds the RqliteClient with the provided hosts.

§Errors

This function will return an error if:

  • No hosts were provided
  • Failed to create HTTP client
  • Invalid authorization header

Trait Implementations§

Source§

impl Default for RqliteClientBuilder

Source§

fn default() -> RqliteClientBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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

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