pub async fn connect<T: ToSocketAddrs>(addr: T) -> Result<Client>
Expand description
Establish a connection with the Redis server located at addr
.
addr
may be any type that can be asynchronously converted to a
SocketAddr
. This includes SocketAddr
and strings. The ToSocketAddrs
trait is the Tokio version and not the std
version.
ยงExamples
use mini_redis::client;
#[tokio::main]
async fn main() {
let client = match client::connect("localhost:6379").await {
Ok(client) => client,
Err(_) => panic!("failed to establish connection"),
};
}