[rust-dev] [ANN] rust-redis and rust-msgpack

Armin Ronacher armin.ronacher at active-4.com
Mon Jan 6 07:56:34 PST 2014


On 04/01/2014 16:16, Michael Neumann wrote:
>> rust-redis: A Redis client library written in pure Rust. Thanks to the new
>> rust runtime
>> it is pretty fast, despite being only 200 lines of code.
Just compared that with the one I'm working on 
(https://github.com/mitsuhiko/redis-rs/) and maybe we can unify those two into 
one.  I plan on continue maintaining mine for a long time to come as I'm using 
redis very frequently.

My biggest issue currently with continue working on it, is that I want to 
replicate the pipeline functionality from the Python and JavaScript 
implementation but I can't see a way of doing that in Rust without having to 
manually generate code.  Macros are not going to be particularly useful.

Primarily the issue is that on the client you want this:

     fn get(&mut self, key: ~str) -> ~str {
         value_as_string(self.execute("GET", [StrArg(key)]))

but on the pipeline you want this behavior:

     let rv = client.pipeline()
           .tap(|s| println!("I got a string: {}", s)

     for result in rv {
         println!("I got result: {}", result);

I am not sure yet how to do this nicely without repeating a lot of code (also I 
have no idea how to make .tap() work).


More information about the Rust-dev mailing list