File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ pub const TYPE_METHOD_VERSION: u64 = raw::REDISMODULE_TYPE_METHOD_VERSION as u64
2121pub trait NextArg {
2222 fn next_arg ( & mut self ) -> Result < RedisString , RedisError > ;
2323 fn next_string ( & mut self ) -> Result < String , RedisError > ;
24+ fn next_str < ' a > ( & mut self ) -> Result < & ' a str , RedisError > ;
2425 fn next_i64 ( & mut self ) -> Result < i64 , RedisError > ;
2526 fn next_u64 ( & mut self ) -> Result < u64 , RedisError > ;
2627 fn next_f64 ( & mut self ) -> Result < f64 , RedisError > ;
4344 }
4445
4546 #[ inline]
46- fn next_i64 ( & mut self ) -> Result < i64 , RedisError > {
47+ fn next_str < ' a > ( & mut self ) -> Result < & ' a str , RedisError > {
48+ self . next ( )
49+ . map_or ( Err ( RedisError :: WrongArity ) , |v| v. try_as_str ( ) )
50+ }
51+
52+ #[ inline]
53+ fn next_i64 ( & mut self ) -> Result < i64 , RedisError > {
4754 self . next ( )
4855 . map_or ( Err ( RedisError :: WrongArity ) , |v| v. parse_integer ( ) )
4956 }
@@ -126,7 +133,7 @@ impl RedisString {
126133 len == 0
127134 }
128135
129- pub fn try_as_str ( & self ) -> Result < & str , RedisError > {
136+ pub fn try_as_str < ' a > ( & self ) -> Result < & ' a str , RedisError > {
130137 Self :: from_ptr ( self . inner ) . map_err ( |_| RedisError :: Str ( "Couldn't parse as UTF-8 string" ) )
131138 }
132139
You can’t perform that action at this time.
0 commit comments