Skip to content

Commit 8d3e596

Browse files
committed
Add more notes about Tagged structs
1 parent 9b87d1e commit 8d3e596

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

IDEAS.md

+17-6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ mod tagged_types {
2929
#[serde(flatten)]
3030
pub version: super::core_types::Rversion,
3131
}
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>
3241
}
3342

3443
// then a server could have
@@ -63,12 +72,14 @@ I forgot about deserialize_with.
6372

6473
## References
6574

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.~~
6779

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.~~
7082

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.~~
7384

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.

0 commit comments

Comments
 (0)