File tree 1 file changed +17
-6
lines changed
1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,15 @@ mod tagged_types {
29
29
#[serde(flatten)]
30
30
pub version : super :: core_types :: Rversion ,
31
31
}
32
+
33
+ // or heck, even
34
+ pub struct Tagged <T > {
35
+ pub tag : u32 ,
36
+ #[serde(flatten)]
37
+ pub message : T
38
+ }
39
+
40
+ pub type Tattach = Tagged <super :: core_types :: Tattach >
32
41
}
33
42
34
43
// then a server could have
@@ -63,12 +72,14 @@ I forgot about deserialize_with.
63
72
64
73
## References
65
74
66
- How do we properly handle the strings within the message types?
75
+ ~~ How do we properly handle the strings within the message types?~~
76
+
77
+ ~~ Right now, they're all ` Cow<'static, str> ` which makes it easy for development.~~
78
+ ~~ However, I don't think it should stay that way in the long run.~~
67
79
68
- Right now, they're all ` Cow<'static, str> ` which makes it easy for development.
69
- However, I don't think it should stay that way in the long run.
80
+ ~~ Each message could/should be generic over the string type. ~~
81
+ ~~ I'd have to see how having that "hidden lifetime" works with the deserializer, though. ~~
70
82
71
- Each message could/should be generic over the string type.
72
- I'd have to see how having that "hidden lifetime" works with the deserializer, though.
83
+ ~~ And I'd need to look at how the serde magic works with generic stuff. Maybe I'd need to write my own functions for it.~~
73
84
74
- And I'd need to look at how the serde magic works with generic stuff. Maybe I'd need to write my own functions for it .
85
+ This is far more cleverness than it's worth. Just make them ` String ` s .
You can’t perform that action at this time.
0 commit comments