1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
use crate::error; pub type Result<T> = ::std::result::Result<T, error::Error>; macro_rules! io_err { ($kind:ident, $msg:expr) => { ::std::io::Error::new(::std::io::ErrorKind::$kind, $msg) }; } macro_rules! res { ($err:expr) => { Err(From::from($err)) }; } pub fn parse_proto(arg: &str) -> Option<(&str, String)> { let mut split = arg.split('!'); let (proto, addr, port) = (split.nth(0)?, split.nth(0)?, split.nth(0)?); Some((proto, addr.to_owned() + ":" + port)) }