File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -21,16 +21,16 @@ fn alloc_set(ctx: &Context, args: Vec<String>) -> RedisResult {
2121 let key = ctx. open_key_writable ( & key) ;
2222
2323 match key. get_value :: < MyType > ( & MY_REDIS_TYPE ) ? {
24+ Some ( value) => {
25+ value. data = "B" . repeat ( size as usize ) ;
26+ }
2427 None => {
2528 let value = MyType {
2629 data : "A" . repeat ( size as usize )
2730 } ;
2831
2932 key. set_value ( & MY_REDIS_TYPE , value) ?;
3033 }
31- Some ( value) => {
32- value. data = "B" . repeat ( size as usize ) ;
33- }
3434 }
3535
3636 Ok ( size. into ( ) )
@@ -43,20 +43,20 @@ fn alloc_get(ctx: &Context, args: Vec<String>) -> RedisResult {
4343 let key = ctx. open_key_writable ( & key) ; // TODO: Use read-only key
4444
4545 let value = match key. get_value :: < MyType > ( & MY_REDIS_TYPE ) ? {
46- None => ( ) . into ( ) ,
4746 Some ( value) => {
4847 // TODO: Use the value
4948 let _ = value;
5049 "some value" . into ( )
5150 }
51+ None => ( ) . into ( )
5252 } ;
5353
5454 Ok ( value)
5555}
5656
5757//////////////////////////////////////////////////////
5858
59- redis_module ! {
59+ redis_module ! {
6060 name: "alloc" ,
6161 version: 1 ,
6262 data_types: [
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ macro_rules! redis_command {
3030 Some ( do_command) ,
3131 flags. as_ptr( ) ,
3232 firstkey, lastkey, keystep,
33- ) == raw:: Status :: Err as _ { return raw:: Status :: Err as _ ; }
33+ ) == raw:: Status :: Err as c_int { return raw:: Status :: Err as c_int ; }
3434 }
3535 }
3636}
@@ -74,11 +74,11 @@ macro_rules! redis_module {
7474 module_name. as_ptr( ) ,
7575 module_version,
7676 raw:: REDISMODULE_APIVER_1 as c_int,
77- ) == raw:: Status :: Err as _ { return raw:: Status :: Err as _ ; }
77+ ) == raw:: Status :: Err as c_int { return raw:: Status :: Err as c_int ; }
7878
7979 $(
8080 if ( & $data_type) . create_data_type( ctx) . is_err( ) {
81- return raw:: Status :: Err as _ ;
81+ return raw:: Status :: Err as c_int ;
8282 }
8383 ) *
8484
@@ -92,7 +92,7 @@ macro_rules! redis_module {
9292 redis_command!( ctx, $name, $command, $flags) ;
9393 ) *
9494
95- raw:: Status :: Ok as _
95+ raw:: Status :: Ok as c_int
9696 }
9797 }
9898 }
You can’t perform that action at this time.
0 commit comments