use redis::{ Client, Connection, Commands }; use ron::de::from_str; pub type Line = Vec<(f32,f32,u32)>; pub struct RedisCtrl { pub client: Client, pub connection: Connection } impl RedisCtrl { pub fn new() -> Result> { let client = Client::open("redis://127.0.0.1/")?; let connection = client.get_connection()?; Ok(RedisCtrl { client, connection }) } pub fn get( &mut self, key: &str ) -> Result> { let val : String = self.connection.get(key)?; let line : Line = from_str(&val)?; Ok(line) } }