Expand description
A simple struct to represent a server address, with host:port or socket path.
Fields
host: Option<String>
Host or ip address of the server.
port: Option<u16>
Port to connect to the server.
path: Option<String>
Use unix socket path to connect.
Implementations
sourceimpl Address
impl Address
sourcepub fn new(host: impl Into<String>, port: u16) -> Self
pub fn new(host: impl Into<String>, port: u16) -> Self
Construct server address with host and port.
sourcepub fn from_host(host: impl Into<String>) -> Self
pub fn from_host(host: impl Into<String>) -> Self
Construct server address with host or ip address only.
sourcepub fn from_path(path: impl Into<String>) -> Self
pub fn from_path(path: impl Into<String>) -> Self
Construct server address with unix socket path.
pub fn is_empty(&self) -> bool
Trait Implementations
impl Eq for Address
impl StructuralEq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more