marshallpierce / base64-serde

Integration between rust-base64 and serde

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No empty struct

dtolnay opened this issue · comments

I would prefer not to generate struct $typename {}. Some better options:

  • struct $typename; -- more idiomatic for a struct with no content
  • enum $typename {} -- cannot be instantiated
  • mod $modname { /* serialize, deserialize */ } -- not a type

I think module is the best option just because there isn't a reason for a type to be involved. Like you would never want to pass this $typename as a generic type parameter somewhere or instantiate it.

I keep forgetting I can have no-curly structs in Rust...

It seems weird to me that there isn't a type for this, but maybe this part of serde will make more sense once I tackle #3.