Struct relay_config::UpstreamDescriptor
source · 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<'a> Display for UpstreamDescriptor<'a>
impl<'a> Display for UpstreamDescriptor<'a>
source§impl FromStr for UpstreamDescriptor<'static>
impl FromStr for UpstreamDescriptor<'static>
§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§fn eq(&self, other: &UpstreamDescriptor<'a>) -> bool
fn eq(&self, other: &UpstreamDescriptor<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'a> PartialOrd for UpstreamDescriptor<'a>
impl<'a> PartialOrd for UpstreamDescriptor<'a>
source§fn partial_cmp(&self, other: &UpstreamDescriptor<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &UpstreamDescriptor<'a>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§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
§impl<T> CallHasher for T
impl<T> CallHasher for T
§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
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.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.