Skip to content
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

Support miniserde/nanoserde? #274

Open
Supreeeme opened this issue Nov 29, 2024 · 3 comments
Open

Support miniserde/nanoserde? #274

Supreeeme opened this issue Nov 29, 2024 · 3 comments

Comments

@Supreeeme
Copy link

I'd like to use this crate in a custom cargo xtask style thing, however the use of serde adds a notable compile time cost to a simple crate with no other dependencies, which is inconvenient for something that is essentially a script. It would be nice to add support for a lighter-weight deserialization crate, such as miniserde or nanoserde. Alternatively, it would even be useful to just make serde optional, and custom deserialization impls could be tacked on.

@oli-obk
Copy link
Owner

oli-obk commented Nov 29, 2024

I don't think we have any notable uses of serde derive features or interesting data structures. I want to avoid writing custom serialization impls, do these others support derives, too?

The main issue is where we use things like Utf8Path, which doesn't support other serialization frameworks

@Supreeeme
Copy link
Author

Both miniserde and nanoserde supports derives, although I would personally prefer nanoserde as it has no other dependencies, and miniserde still depends on syn. I think the most useful thing missing though from both is internally tagged enums, which is used for the message types. Those would require a semi-manual implementation, but it's not terribly difficult to implement in the case of nanoserde. Nanoserde also supports remote (called "proxy" there) derives. There's a nice list of supported features on the readme (cargo_metadata obviously only cares about the json column).

@oli-obk
Copy link
Owner

oli-obk commented Nov 30, 2024

I think we should put serde under a cargo feature. Internally we can use nanoserde, but others may be using serde on our data structures directly and I want to keep supporting that.

We can even make serde an optional feature to avoid everyone pulling it in unless they need it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants