use std::net::SocketAddr;
#[derive(Debug, Clone)]
pub struct ServerConfig {
pub host: String,
pub port: u16,
}
impl ServerConfig {
pub fn new(host: impl Into<String>, port: u16) -> Self {
Self {
host: host.into(),
port,
}
}
pub fn socket_addr(&self) -> Result<SocketAddr, std::net::AddrParseError> {
format!("{}:{}", self.host, self.port).parse()
}
}