[][src]Struct systemd_socket::SocketAddr

pub struct SocketAddr(_);

Socket address that can be an ordinary address or a systemd socket

This is the core type of this crate that abstracts possible addresses. It can be (fallibly) converted from various types of strings or deserialized with serde. After it's created, it can be bound as TcpListener from std or even tokio or async_std if the appropriate feature is enabled.

Optional dependencies on parse_arg and serde make it trivial to use with configure_me.

Implementations

impl SocketAddr[src]

pub fn from_systemd_name<T: Into<String>>(name: T) -> Result<Self, ParseError>[src]

Creates SocketAddr from systemd name directly, without requiring systemd:// prefix.

Always fails with systemd unsupported error if systemd is not supported.

pub fn bind(self) -> Result<TcpListener, BindError>[src]

Creates std::net::TcpListener

This method either binds the socket, if the address was provided or uses systemd socket if the socket name was provided.

Trait Implementations

impl Debug for SocketAddr[src]

impl Display for SocketAddr[src]

Displays the address in format that can be parsed again.

Important: While I don't expect this impl to change, don't rely on it! It should be used mostly for debugging/logging.

impl<I: Into<IpAddr>> From<(I, u16)> for SocketAddr[src]

impl From<SocketAddr> for SocketAddr[src]

impl From<SocketAddrV4> for SocketAddr[src]

impl From<SocketAddrV6> for SocketAddr[src]

impl FromStr for SocketAddr[src]

type Err = ParseError

The associated error which can be returned from parsing.

impl<'a> TryFrom<&'a OsStr> for SocketAddr[src]

type Error = ParseOsStrError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a str> for SocketAddr[src]

type Error = ParseError

The type returned in the event of a conversion error.

impl TryFrom<OsString> for SocketAddr[src]

type Error = ParseOsStrError

The type returned in the event of a conversion error.

impl TryFrom<String> for SocketAddr[src]

type Error = ParseError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.