I am trying to use this library:
In order to do this properly, I need to initialize the connection as such:
// connect to redis
let client = try!(redis::Client::open(“redis://127.0.0.1/”));
let con = try!(client.get_connection());
Ideally I could have con as a global variable but I can’t start it it as a null, since rust doesn’t support nulls, and I believe I can’t call a function before main executes to set those variables.
Should I just initialize con in main and pad it all over? Is there a better way to do this? Ideally I’d like a standalone library and my calling functions don’t have to deal with this.