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

Expose machine_message.rs as a crate so that it's easy for third party tools #8142

Closed
richardwhiuk opened this issue Apr 21, 2020 · 2 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@richardwhiuk
Copy link

Describe the problem you are trying to solve

Currently https://doc.rust-lang.org/cargo/reference/external-tools.html#json-messages nicely describes the messages which Cargo can output.

However, there's no programmatic definition, so integrations are forced to copy and paste structs out of Cargo's code to parse them.

Describe the solution you'd like

It'd be nice if there was a rust crate which a) Cargo used to define these messages and b) third party developers could pull and use serde::Deserialise to parse them.

@richardwhiuk richardwhiuk added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Apr 21, 2020
@ehuss
Copy link
Contributor

ehuss commented Apr 21, 2020

The types are available via the cargo_metadata crate (see the Message type).

bors added a commit that referenced this issue Apr 25, 2020
Mention that cargo_metadata can parse json messages

Prompted by #8142, this updates the documentation to mention that cargo_metadata can parse the external JSON messages emitted when the `--message-format=json` option is set.
@ehuss
Copy link
Contributor

ehuss commented Apr 26, 2020

Closing, cargo_metadata is the intended way, particularly if using serde.

@ehuss ehuss closed this as completed Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants