pub struct Backend {
pub addr: SocketAddr,
pub weight: usize,
pub ext: Extensions,
}
Expand description
Backend represents a server to proxy or connect to.
Fields§
§addr: SocketAddr
The address to the backend server.
weight: usize
The relative weight of the server. Load balancing algorithms will proportionally distributed traffic according to this value.
ext: Extensions
The extension field to put arbitrary data to annotate the Backend.
The data added here is opaque to this crate hence the data is ignored by
functionalities of this crate. For example, two backends with the same
SocketAddr and the same weight but different ext
data are considered
identical.
See Extensions for how to add and read the data.
Implementations§
Source§impl Backend
impl Backend
Sourcepub fn new(addr: &str) -> Result<Self>
pub fn new(addr: &str) -> Result<Self>
Create a new Backend with weight
1. The function will try to parse
addr
into a std::net::SocketAddr.
Sourcepub fn new_with_weight(addr: &str, weight: usize) -> Result<Self>
pub fn new_with_weight(addr: &str, weight: usize) -> Result<Self>
Creates a new Backend with the specified weight
. The function will try to parse
addr
into a std::net::SocketAddr.
Methods from Deref<Target = SocketAddr>§
Trait Implementations§
Source§impl Ord for Backend
impl Ord for Backend
Source§impl PartialOrd for Backend
impl PartialOrd for Backend
Source§impl ToSocketAddrs for Backend
impl ToSocketAddrs for Backend
Source§type Iter = Once<SocketAddr>
type Iter = Once<SocketAddr>
Source§fn to_socket_addrs(&self) -> Result<Self::Iter>
fn to_socket_addrs(&self) -> Result<Self::Iter>
SocketAddr
s. Read moreimpl Eq for Backend
Auto Trait Implementations§
impl Freeze for Backend
impl !RefUnwindSafe for Backend
impl Send for Backend
impl Sync for Backend
impl Unpin for Backend
impl !UnwindSafe for Backend
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
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)
clone_to_uninit
)Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<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
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
key
and return true
if they are equal.