-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional Metadata for Schema? #192
Comments
|
Whatcha mean by custom enum discriminants? (Postcard specifically states that it uses "lexical ordering") |
enum Foo {
A = 1,
...
} Similar to comments, serde and postcard don't care about discriminants and use a 0-indexed "lexical ordering", but some use cases of |
Annotations as in something like this? #[postcard(serialized_size(max = 512))]
bytes: Vec<u8>,
One way this could work is by having a wrapper type for customizing hashing behavior: struct HashBy<T> {
// Which fields to include in the hash
fields: Fields,
value: T,
}
// Could be a bitset or something more compact
struct Fields {
names: bool,
max_size: bool,
...
}
impl Hash for HashBy<NamedType> {}
...
I could see this working with a One other open question:
|
re: hashing, I specifically meant what re: annotations, it could mean that! It would specifically be an annotation used when deriving re: enum discriminants, hmm, that makes sense, I wonder if this adds more confusion than is useful. re: "How much will additional (unused) metadata affect type and binary sizes", I would assume for "non-postcard-rpc users", it would be elided. However postcard-rpc supports sending the schemas for all endpoints, so I would assume it would be included in those cases. I don't assume the compiler is smart enough (yet) to totally remove unused fields (only totally unused consts). |
The least surprising option would probably be to consider only the pieces that break wire compatibility if changed, i.e. only the serde-relevant pieces.
Would be nice to have a serializer/deserializer flag to reject oversized inputs (re. #135) but that might be tricky to integrate with the various
It might, but wanted to mention it since they're meaningful in some cases. |
CC @max-heller and #179
There have been a couple of asks for additional schema metadata. Off the top of my head:
postcard-rpc
'sEndpoint
s andTopic
s, which tend to benefit from metadata as wellOpen questions would be:
The text was updated successfully, but these errors were encountered: