cronback-lib 0.1.0

Common utilities for all cronback services
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::net::{IpAddr, SocketAddr};
use std::str::FromStr;

use anyhow::Result;

pub fn parse_addr<A>(address: A, port: u16) -> Result<SocketAddr>
where
    A: AsRef<str>,
{
    let addr = IpAddr::from_str(address.as_ref())?;

    Ok(SocketAddr::from((addr, port)))
}