pub enum Addresses {
Direct(Vec<Address>),
Translated(HashMap<Address, Address>),
}Expand description
A collection of server addresses used for connection.
Variants§
Implementations§
Source§impl Addresses
impl Addresses
Sourcepub fn try_from_address_str(address_str: impl AsRef<str>) -> Result<Self>
pub fn try_from_address_str(address_str: impl AsRef<str>) -> Result<Self>
Prepare addresses based on a single “host:port” string.
§Examples
Addresses::try_from_address_str("127.0.0.1:11729")Sourcepub fn from_address(address: Address) -> Self
pub fn from_address(address: Address) -> Self
Prepare addresses based on a single TypeDB address.
§Examples
let address = "127.0.0.1:11729".parse().unwrap();
Addresses::from_address(address)Sourcepub fn try_from_addresses_str(
addresses_str: impl IntoIterator<Item = impl AsRef<str>>,
) -> Result<Self>
pub fn try_from_addresses_str( addresses_str: impl IntoIterator<Item = impl AsRef<str>>, ) -> Result<Self>
Prepare addresses based on multiple “host:port” strings. Is used to specify multiple addresses connect to.
§Examples
Addresses::try_from_addresses_str(["127.0.0.1:11729", "127.0.0.1:11730", "127.0.0.1:11731"])Sourcepub fn from_addresses(addresses: impl IntoIterator<Item = Address>) -> Self
pub fn from_addresses(addresses: impl IntoIterator<Item = Address>) -> Self
Prepare addresses based on multiple TypeDB addresses.
§Examples
let address1 = "127.0.0.1:11729".parse().unwrap();
let address2 = "127.0.0.1:11730".parse().unwrap();
let address3 = "127.0.0.1:11731".parse().unwrap();
Addresses::from_addresses([address1, address2, address3])Sourcepub fn try_from_translation_str(
addresses_str: HashMap<impl AsRef<str>, impl AsRef<str>>,
) -> Result<Self>
pub fn try_from_translation_str( addresses_str: HashMap<impl AsRef<str>, impl AsRef<str>>, ) -> Result<Self>
Prepare addresses based on multiple key-value (public-private) “key:port” string pairs. Translation map from addresses to be used by the driver for connection to addresses received from the TypeDB server(s).
§Examples
Addresses::try_from_addresses_str(
[
("typedb-cloud.ext:11729", "127.0.0.1:11729"),
("typedb-cloud.ext:11730", "127.0.0.1:11730"),
("typedb-cloud.ext:11731", "127.0.0.1:11731")
].into()
)Sourcepub fn from_translation(addresses: HashMap<Address, Address>) -> Self
pub fn from_translation(addresses: HashMap<Address, Address>) -> Self
Prepare addresses based on multiple key-value (public-private) TypeDB address pairs. Translation map from addresses to be used by the driver for connection to addresses received from the TypeDB server(s).
§Examples
let translation: HashMap<Address, Address> = [
("typedb-cloud.ext:11729".parse()?, "127.0.0.1:11729".parse()?),
("typedb-cloud.ext:11730".parse()?, "127.0.0.1:11730".parse()?),
("typedb-cloud.ext:11731".parse()?, "127.0.0.1:11731".parse()?)
].into();
Addresses::from_translation(translation)Trait Implementations§
impl Eq for Addresses
impl StructuralPartialEq for Addresses
Auto Trait Implementations§
impl Freeze for Addresses
impl RefUnwindSafe for Addresses
impl Send for Addresses
impl Sync for Addresses
impl Unpin for Addresses
impl UnsafeUnpin for Addresses
impl UnwindSafe for Addresses
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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