Skip to content

Commit 9e4f975

Browse files
authored
Merge pull request redis-rs#89 from mitsuhiko/toredisargs-for-string-ref
Implement ToRedisArgs for &String to make it work without slicing
2 parents 856a820 + 1a67dd1 commit 9e4f975

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/types.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,12 @@ impl ToRedisArgs for String {
503503
}
504504
}
505505

506+
impl<'a> ToRedisArgs for &'a String {
507+
fn to_redis_args(&self) -> Vec<Vec<u8>> {
508+
vec![self.as_bytes().to_vec()]
509+
}
510+
}
511+
506512
impl<'a> ToRedisArgs for &'a str {
507513
fn to_redis_args(&self) -> Vec<Vec<u8>> {
508514
vec![self.as_bytes().to_vec()]

0 commit comments

Comments
 (0)