pub struct Connection { /* private fields */ }
Expand description
A connection to a TypeDB server which serves as the starting point for all interaction.
Implementations§
source§impl Connection
impl Connection
sourcepub fn new_cloud<T: AsRef<str> + Sync>(
init_addresses: &[T],
credential: Credential,
) -> Result<Self>
pub fn new_cloud<T: AsRef<str> + Sync>( init_addresses: &[T], credential: Credential, ) -> Result<Self>
Creates a new TypeDB Cloud connection.
§Arguments
init_addresses
– Addresses (host:port) on which TypeDB Cloud nodes are runningcredential
– User credential and TLS encryption setting
§Examples
Connection::new_cloud(
&["localhost:11729", "localhost:21729", "localhost:31729"],
Credential::with_tls(
"admin",
"password",
Some(&PathBuf::from(
std::env::var("ROOT_CA")
.expect("ROOT_CA environment variable needs to be set for cloud tests to run"),
)),
)?,
)
sourcepub fn new_cloud_with_translation<T, U>(
address_translation: HashMap<T, U>,
credential: Credential,
) -> Result<Self>
pub fn new_cloud_with_translation<T, U>( address_translation: HashMap<T, U>, credential: Credential, ) -> Result<Self>
Creates a new TypeDB Cloud connection.
§Arguments
address_translation
– Translation map from addresses to be used by the driver for connection to addresses received from the TypeDB server(s)credential
– User credential and TLS encryption setting
§Examples
Connection::new_cloud_with_translation(
[
("typedb-cloud.ext:11729", "localhost:11729"),
("typedb-cloud.ext:21729", "localhost:21729"),
("typedb-cloud.ext:31729", "localhost:31729"),
].into(),
credential,
)
sourcepub fn force_close(&self) -> Result
pub fn force_close(&self) -> Result
Trait Implementations§
source§impl Clone for Connection
impl Clone for Connection
source§fn clone(&self) -> Connection
fn clone(&self) -> Connection
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for Connection
impl !RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl !UnwindSafe for Connection
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request