Struct ConfigBuilder

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

Builder for Config.

Implementations§

Source§

impl ConfigBuilder

Source

pub fn endpoint<VALUE: Into<String>>(self, value: VALUE) -> Self

Set the URI to use to reach the Spanner API. Leave unspecified to use Cloud Spanner.

Source

pub fn tls_config(self, value: ClientTlsConfig) -> Self

Set custom client-side TLS settings.

Source

pub fn project<VALUE: Into<String>>(self, value: VALUE) -> Self

Specify the GCP project where the Cloud Spanner instance exists.

This may be left unspecified, in which case, the project will be extracted from the credentials. Note that this only works when authenticating using service accounts.

Source

pub fn instance<VALUE: Into<String>>(self, value: VALUE) -> Self

Set the Cloud Spanner instance ID.

Source

pub fn database<VALUE: Into<String>>(self, value: VALUE) -> Self

Set the Cloud Spanner database name.

Source

pub fn credentials_file<VALUE: Into<String>>(self, value: VALUE) -> Self

Programatically specify the credentials file to use during authentication.

When this is specified, it is used in favor of the GOOGLE_APPLICATION_CREDENTIALS environment variable.

Source

pub fn session_pool_config(self, value: SessionPoolConfig) -> Self

Configuration for the embedded session pool.

Source

pub fn build(self) -> Result<Config, Error>

Builds a new Config.

§Errors

If a required field has not been initialized.

Source§

impl ConfigBuilder

Source

pub fn disable_tls(self) -> Self

Disable TLS when connecting to Spanner. This usually only makes sense when using the emulator. Note that this also disables authentication to prevent sending secrets in plain text.

Source

pub fn with_emulator_host(self, endpoint: String) -> Self

Configure the client to connect to a Spanner emulator, e.g.: http://localhost:9092 This disables TLS.

Source

pub fn with_emulator_grpc_port(self, port: u16) -> Self

Configure the client to connect to a Spanner emulator running on localhost and using the specified port. This disables TLS.

Source

pub async fn connect(self) -> Result<Client, Error>

Trait Implementations§

Source§

impl Default for ConfigBuilder

Source§

fn default() -> Self

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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