pub struct UpstreamDescriptor<'a> { /* private fields */ }
Expand description
The upstream target is a type that holds all the information to uniquely identify an upstream target.
Implementations§
source§impl<'a> UpstreamDescriptor<'a>
impl<'a> UpstreamDescriptor<'a>
sourcepub fn new(host: &'a str, port: u16, scheme: Scheme) -> UpstreamDescriptor<'a>
pub fn new(host: &'a str, port: u16, scheme: Scheme) -> UpstreamDescriptor<'a>
Manually constructs an upstream descriptor.
sourcepub fn from_dsn(dsn: &'a Dsn) -> UpstreamDescriptor<'a>
pub fn from_dsn(dsn: &'a Dsn) -> UpstreamDescriptor<'a>
Given a DSN this returns an upstream descriptor that describes it.
sourcepub fn socket_addr(self) -> Result<SocketAddr, UpstreamError>
pub fn socket_addr(self) -> Result<SocketAddr, UpstreamError>
Returns the socket address of the upstream.
This might perform a DSN lookup and could fail. Callers are encouraged this call this regularly as DNS might be used for load balancing purposes and results might expire.
sourcepub fn into_owned(self) -> UpstreamDescriptor<'static>
pub fn into_owned(self) -> UpstreamDescriptor<'static>
Returns a version of the upstream descriptor that is static.
Trait Implementations§
source§impl<'a> Clone for UpstreamDescriptor<'a>
impl<'a> Clone for UpstreamDescriptor<'a>
source§fn clone(&self) -> UpstreamDescriptor<'a>
fn clone(&self) -> UpstreamDescriptor<'a>
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 moresource§impl<'a> Debug for UpstreamDescriptor<'a>
impl<'a> Debug for UpstreamDescriptor<'a>
source§impl Default for UpstreamDescriptor<'static>
impl Default for UpstreamDescriptor<'static>
source§fn default() -> UpstreamDescriptor<'static>
fn default() -> UpstreamDescriptor<'static>
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for UpstreamDescriptor<'static>
impl<'de> Deserialize<'de> for UpstreamDescriptor<'static>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for UpstreamDescriptor<'_>
impl Display for UpstreamDescriptor<'_>
source§impl FromStr for UpstreamDescriptor<'static>
impl FromStr for UpstreamDescriptor<'static>
source§type Err = UpstreamParseError
type Err = UpstreamParseError
The associated error which can be returned from parsing.
source§fn from_str(s: &str) -> Result<UpstreamDescriptor<'static>, UpstreamParseError>
fn from_str(s: &str) -> Result<UpstreamDescriptor<'static>, UpstreamParseError>
Parses a string
s
to return a value of this type. Read moresource§impl<'a> Hash for UpstreamDescriptor<'a>
impl<'a> Hash for UpstreamDescriptor<'a>
source§impl<'a> Ord for UpstreamDescriptor<'a>
impl<'a> Ord for UpstreamDescriptor<'a>
source§fn cmp(&self, other: &UpstreamDescriptor<'a>) -> Ordering
fn cmp(&self, other: &UpstreamDescriptor<'a>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<'a> PartialEq for UpstreamDescriptor<'a>
impl<'a> PartialEq for UpstreamDescriptor<'a>
source§impl<'a> PartialOrd for UpstreamDescriptor<'a>
impl<'a> PartialOrd for UpstreamDescriptor<'a>
source§impl Serialize for UpstreamDescriptor<'static>
impl Serialize for UpstreamDescriptor<'static>
impl<'a> Eq for UpstreamDescriptor<'a>
impl<'a> StructuralPartialEq for UpstreamDescriptor<'a>
Auto Trait Implementations§
impl<'a> Freeze for UpstreamDescriptor<'a>
impl<'a> RefUnwindSafe for UpstreamDescriptor<'a>
impl<'a> Send for UpstreamDescriptor<'a>
impl<'a> Sync for UpstreamDescriptor<'a>
impl<'a> Unpin for UpstreamDescriptor<'a>
impl<'a> UnwindSafe for UpstreamDescriptor<'a>
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
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more