Skip to content

Commit 12a027a

Browse files
committed
More cleanups
1 parent 135dd8f commit 12a027a

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

examples/data_type.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ struct MyType {
99
data: String,
1010
}
1111

12-
impl Default for MyType {
13-
fn default() -> Self {
14-
MyType { data: Default::default() }
15-
}
16-
}
17-
1812
static MY_REDIS_TYPE: RedisType = RedisType::new("mytype123");
1913

2014
fn alloc_set(ctx: &Context, args: Vec<String>) -> RedisResult {

src/key.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl RedisKeyWritable {
173173
Ok("OK".into())
174174
}
175175

176-
pub fn get_value<T: Default>(&self, redis_type: &RedisType) -> Result<&mut T, RedisError> {
176+
pub fn get_value<T: Debug>(&self, redis_type: &RedisType) -> Result<&mut T, RedisError> {
177177
self.verify_type(redis_type)?;
178178

179179
let value = unsafe {
@@ -186,6 +186,8 @@ impl RedisKeyWritable {
186186

187187
let value = unsafe { &mut *value };
188188

189+
redis_log(self.ctx, format!("got value: '{:?}'", value).as_str());
190+
189191
Ok(value)
190192
}
191193

src/redismodule.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ impl From<i64> for RedisValue {
2727
}
2828
}
2929

30+
impl From<String> for RedisValue {
31+
fn from(s: String) -> Self {
32+
RedisValue::String(s)
33+
}
34+
}
35+
3036
impl From<&str> for RedisValue {
3137
fn from(s: &str) -> Self {
3238
RedisValue::String(s.to_string())

0 commit comments

Comments
 (0)