Skip to content

Commit

Permalink
Provide ToConfigListenAddr implementations for string types
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalmer committed Mar 31, 2024
1 parent ecb4697 commit 2927008
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/connection.rs
Expand Up @@ -176,6 +176,22 @@ impl ToConfigListenAddr for ConfigListenAddr {
}
}

impl ToConfigListenAddr for &str {
type Err = String;

fn to_config_listen_addr(self) -> Result<ConfigListenAddr, Self::Err> {
self.parse()
}
}

impl ToConfigListenAddr for &String {
type Err = String;

fn to_config_listen_addr(self) -> Result<ConfigListenAddr, Self::Err> {
self.parse()
}
}

/// Unified listen socket address. Either a [`SocketAddr`] or [`std::os::unix::net::SocketAddr`].
#[derive(Debug, Clone)]
pub enum ListenAddr {
Expand Down

0 comments on commit 2927008

Please sign in to comment.