Skip to content

Add support for embedding in-memory proto files into the parser #770

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Joshuahoky
Copy link

This PR adds support for embedding .proto files directly into the parser as in-memory strings. This is useful because it eliminates the need to always rely on filesystem-based inputs.

I Introduced a new method (add_custom_embedded) and field (custom_embedded) in the Parser struct which allowed .proto files to be directly added as (name, content) pairs via a HashMap<String, String>. These embedded files are then used by the pure parser during resolution if the file cannot be found on disk.

@Joshuahoky
Copy link
Author

@stepancheg is it possible for you to look at this PR? our parser (https://github.com/cloudwego/pilota) relies heavily on this crate and it would really help if we could incorporate this feature into the official rust-protobuf without forking our own copy. thanks!

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

Successfully merging this pull request may close these issues.

1 participant