Initial commit

This commit is contained in:
Carl Lerche
2019-12-03 21:49:10 -08:00
commit 358e95e57c
22 changed files with 1420 additions and 0 deletions

28
src/client.rs Normal file
View File

@@ -0,0 +1,28 @@
#![cfg(nope)]
use crate::Connection;
use bytes::Bytes;
use tokio::net::{TcpStream, ToSocketAddrs};
use std::io;
/// Mini asynchronous Redis client
pub struct Client {
conn: Connection,
}
pub async fn connect<T: ToSocketAddrs>(addr: T) -> io::Result<Client> {
let socket = TcpStream::connect(addr).await?;
let conn = Connection::new(socket);
Ok(Client { conn })
}
impl Client {
pub async fn get(&mut self, key: &str) -> io::Result<Option<Bytes>> {
unimplemented!();
}
pub async fn set(&mut self, key: &str, val: Bytes) -> io::Result<()> {
unimplemented!();
}
}