fn from_str(connection_str: &str) -> Result<Self> {
        let splits = connection_str.splitn(2, ':').collect::<Vec<_>>();
        if splits.len() == 2 && splits[0] == "unix" {
            Ok(Connection::Unix(UnixStream::connect(splits[1])?))
        } else if splits.len() == 2 && splits[0] == "tcp" {
            Ok(Connection::Tcp(TcpStream::connect(splits[1])?))
        } else {
            Err(Error::new(
                ErrorKind::InvalidInput,
                "Unknown connection type",
            ))
        }
    }
/// Takes a string in the format type:connection_str and tries to connect
/// to that location. Returns the connection inside an enum that can be used
/// inside DaZeus directly.
Takes a string in the format type:connection_str and tries to connect
to that location. Returns the connection inside an enum that can be used
inside DaZeus directly.
Takes a string in the format type : connection_str and tries to connect to that location . Returns the connection inside an enum that can be used inside DaZeus directly .
fn from_str(connection_str: &str) -> Result<Self> {
        let splits = connection_str.splitn(2, ':').collect::<Vec<_>>();
        if splits.len() == 2 && splits[0] == "unix" {
            Ok(Connection::Unix(UnixStream::connect(splits[1])?))
        } else if splits.len() == 2 && splits[0] == "tcp" {
            Ok(Connection::Tcp(TcpStream::connect(splits[1])?))
        } else {
            Err(Error::new(
                ErrorKind::InvalidInput,
                "Unknown connection type",
            ))
        }
    }
fn from_str ( connection_str : & str ) -> Result < Self > { let splits = connection_str . splitn ( 2 , ':' ) . collect :: < Vec < _ > > ( ) ; if splits . len ( ) == 2 && splits [ 0 ] == " " { Ok ( Connection :: Unix ( UnixStream :: connect ( splits [ 1 ] ) ? ) ) } else if splits . len ( ) == 2 && splits [ 0 ] == " " { Ok ( Connection :: Tcp ( TcpStream :: connect ( splits [ 1 ] ) ? ) ) } else { Err ( Error :: new ( ErrorKind :: InvalidInput , " " , ) ) } }
Takes a string in the format type:connection_str and tries to connect
to that location.
Takes a string in the format type : connection_str and tries to connect to that location .
connection_str
&str