pub struct ConfServer { /* private fields */ }Expand description
A servers: entry: a single backing datastore endpoint.
§Examples
use dynomite::conf::ConfServer;
let s = ConfServer::parse("127.0.0.1:6379:1 redis_a").unwrap();
assert_eq!(s.host(), "127.0.0.1");
assert_eq!(s.port(), 6379);
assert_eq!(s.weight(), 1);
assert_eq!(s.name(), "redis_a");Implementations§
Source§impl ConfServer
impl ConfServer
Sourcepub fn parse(raw: &str) -> Result<Self, ConfError>
pub fn parse(raw: &str) -> Result<Self, ConfError>
Parse a host:port:weight [name] (or /path:weight [name]) string.
§Examples
use dynomite::conf::ConfServer;
let unix = ConfServer::parse("/tmp/redis.sock:1").unwrap();
assert!(unix.is_unix());
assert_eq!(unix.port(), 0);
assert!(ConfServer::parse("").is_err());Sourcepub fn pname(&self) -> &str
pub fn pname(&self) -> &str
The original host:port:weight portion (without any friendly name).
§Examples
use dynomite::conf::ConfServer;
let s = ConfServer::parse("127.0.0.1:6379:1 redis_a").unwrap();
assert_eq!(s.pname(), "127.0.0.1:6379:1");Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The hashing-key name for this server.
§Examples
use dynomite::conf::ConfServer;
// Port 11211 is treated as a default and dropped from the name.
assert_eq!(ConfServer::parse("10.0.0.1:11211:1").unwrap().name(), "10.0.0.1");
assert_eq!(ConfServer::parse("10.0.0.1:6379:1").unwrap().name(), "10.0.0.1:6379");Sourcepub fn host(&self) -> &str
pub fn host(&self) -> &str
Hostname or IP address for an inet entry, or the Unix socket path.
§Examples
use dynomite::conf::ConfServer;
assert_eq!(ConfServer::parse("127.0.0.1:6379:1").unwrap().host(), "127.0.0.1");Sourcepub fn port(&self) -> u16
pub fn port(&self) -> u16
TCP port; 0 for Unix socket entries.
§Examples
use dynomite::conf::ConfServer;
assert_eq!(ConfServer::parse("127.0.0.1:6379:1").unwrap().port(), 6379);
assert_eq!(ConfServer::parse("/var/run/r.sock:1").unwrap().port(), 0);Trait Implementations§
Source§impl Clone for ConfServer
impl Clone for ConfServer
Source§fn clone(&self) -> ConfServer
fn clone(&self) -> ConfServer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConfServer
impl Debug for ConfServer
Source§impl<'de> Deserialize<'de> for ConfServer
impl<'de> Deserialize<'de> for ConfServer
Source§fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ConfServer
impl Display for ConfServer
Source§impl PartialEq for ConfServer
impl PartialEq for ConfServer
Source§fn eq(&self, other: &ConfServer) -> bool
fn eq(&self, other: &ConfServer) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ConfServer
impl Serialize for ConfServer
impl Eq for ConfServer
impl StructuralPartialEq for ConfServer
Auto Trait Implementations§
impl Freeze for ConfServer
impl RefUnwindSafe for ConfServer
impl Send for ConfServer
impl Sync for ConfServer
impl Unpin for ConfServer
impl UnsafeUnpin for ConfServer
impl UnwindSafe for ConfServer
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§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§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.