pub struct ConfListen { /* private fields */ }Expand description
A parsed listen: / dyn_listen: / stats_listen: endpoint.
Resolution to a sockinfo is intentionally not represented here
because address resolution is deferred to the runtime layer.
§Examples
use dynomite::conf::ConfListen;
let l = ConfListen::parse("listen", "127.0.0.1:8102").unwrap();
assert_eq!(l.name(), "127.0.0.1");
assert_eq!(l.port(), 8102);Implementations§
Source§impl ConfListen
impl ConfListen
Sourcepub fn parse(field: &'static str, raw: &str) -> Result<Self, ConfError>
pub fn parse(field: &'static str, raw: &str) -> Result<Self, ConfError>
Parse a raw endpoint string for the named directive.
field names the directive; it is folded into the error so
callers can produce helpful diagnostics.
§Examples
use dynomite::conf::{ConfListen, EndpointKind};
let l = ConfListen::parse("dyn_listen", "node-1.example.com:8101").unwrap();
assert_eq!(l.kind(), EndpointKind::Hostname);
assert_eq!(l.port(), 8101);
assert!(ConfListen::parse("dyn_listen", "node-1.example.com").is_err());Sourcepub fn pname(&self) -> &str
pub fn pname(&self) -> &str
The original textual value (name:port).
§Examples
use dynomite::conf::ConfListen;
let l = ConfListen::parse("listen", "127.0.0.1:8102").unwrap();
assert_eq!(l.pname(), "127.0.0.1:8102");Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The host portion (without surrounding brackets, if any).
§Examples
use dynomite::conf::ConfListen;
let l = ConfListen::parse("listen", "[::1]:8101").unwrap();
assert_eq!(l.name(), "::1");Sourcepub fn port(&self) -> u16
pub fn port(&self) -> u16
The port number; 0 for Unix socket paths.
§Examples
use dynomite::conf::ConfListen;
assert_eq!(ConfListen::parse("listen", "127.0.0.1:8102").unwrap().port(), 8102);
assert_eq!(ConfListen::parse("listen", "/tmp/d.sock").unwrap().port(), 0);Sourcepub fn kind(&self) -> EndpointKind
pub fn kind(&self) -> EndpointKind
The endpoint kind classification.
§Examples
use dynomite::conf::{ConfListen, EndpointKind};
let l = ConfListen::parse("listen", "127.0.0.1:8102").unwrap();
assert_eq!(l.kind(), EndpointKind::V4);Trait Implementations§
Source§impl Clone for ConfListen
impl Clone for ConfListen
Source§fn clone(&self) -> ConfListen
fn clone(&self) -> ConfListen
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 ConfListen
impl Debug for ConfListen
Source§impl<'de> Deserialize<'de> for ConfListen
impl<'de> Deserialize<'de> for ConfListen
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 ConfListen
impl Display for ConfListen
Source§impl PartialEq for ConfListen
impl PartialEq for ConfListen
Source§fn eq(&self, other: &ConfListen) -> bool
fn eq(&self, other: &ConfListen) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ConfListen
impl Serialize for ConfListen
impl Eq for ConfListen
impl StructuralPartialEq for ConfListen
Auto Trait Implementations§
impl Freeze for ConfListen
impl RefUnwindSafe for ConfListen
impl Send for ConfListen
impl Sync for ConfListen
impl Unpin for ConfListen
impl UnsafeUnpin for ConfListen
impl UnwindSafe for ConfListen
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.