I need to implement the ConnectionLike
trait from Redis for my own wrapper struct to bypass the orphan rule:
pub trait ConnectionLike {
// Required methods
fn req_packed_command(&mut self, cmd: &[u8]) -> RedisResult<Value>;
fn req_packed_commands(
&mut self,
cmd: &[u8],
offset: usize,
count: usize
) -> RedisResult<Vec<Value>>;
fn get_db(&self) -> i64;
fn check_connection(&mut self) -> bool;
fn is_open(&self) -> bool;
// Provided method
fn req_command(&mut self, cmd: &Cmd) -> RedisResult<Value> { ... }
}
URL: ConnectionLike in redis - Rust
How do I implement the logic of each required method? Should I try to dig up Redis's own implementation of ConnectionLike
within their crate and copy their code?