1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// TODO: COMMENTED OUT UNTIL DEADPOOL REDIS CATCHES UP WITH REDIS 1.0
// use deadpool_redis::{
// // Very important to import inner redis - otherwise macro expansion fails!
// redis,
// redis::{AsyncCommands, ErrorKind, RedisError, RedisResult},
// Config,
// Runtime,
// };
// use redis_macros::{FromRedisValue, ToRedisArgs};
// use serde::{Deserialize, Serialize};
use RedisResult;
// /// Define structs to hold the data
// /// Children structs don't have to implement FromRedisValue, ToRedisArgs, unless you want to use them as top level
// /// They have to implement serde traits though!
// #[derive(Debug, PartialEq, Serialize, Deserialize)]
// enum Address {
// Street(String),
// Road(String),
// }
// /// Don't forget to implement serde traits and redis traits!
// #[derive(Debug, PartialEq, Serialize, Deserialize, FromRedisValue, ToRedisArgs)]
// struct User {
// id: u32,
// name: String,
// addresses: Vec<Address>,
// }
/// Show a simple async usage of redis_macros traits
/// Just derive the traits and forget them!
async