{"id":18006504,"url":"https://github.com/plietar/rust-protobuf-build","last_synced_at":"2025-03-26T12:30:41.685Z","repository":{"id":145798152,"uuid":"49533521","full_name":"plietar/rust-protobuf-build","owner":"plietar","description":"Generate Protobuf Rust sources during `cargo build`","archived":false,"fork":false,"pushed_at":"2018-02-27T19:11:37.000Z","size":4,"stargazers_count":2,"open_issues_count":4,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T18:21:16.721Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plietar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-12T22:37:51.000Z","updated_at":"2016-07-13T03:55:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"4a432bda-a2c5-439b-b5ec-b1caf6800345","html_url":"https://github.com/plietar/rust-protobuf-build","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plietar%2Frust-protobuf-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plietar%2Frust-protobuf-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plietar%2Frust-protobuf-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plietar%2Frust-protobuf-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plietar","download_url":"https://codeload.github.com/plietar/rust-protobuf-build/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245653771,"owners_count":20650750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T01:08:39.289Z","updated_at":"2025-03-26T12:30:41.679Z","avatar_url":"https://github.com/plietar.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-protobuf-build\nGenerate Protobuf Rust sources during `cargo build`.\n\nThis crate simplifies protobuf files generation, by allowing them to be generated by cargo.\n`protoc-gen-rust` does not need to be in $PATH for it to work, reducing the number of external dependencies.\n\nOn the other hand, `libprotoc-dev` is required.\n\n## Usage\nAdd to your `Cargo.toml`\n```toml\n[package]\nbuild = \"build.rs\"\n\n[build-dependencies.protobuf-build]\ngit = \"https://github.com/plietar/rust-protobuf-build.git\"\n```\n\nAnd create a [cargo build script](http://doc.crates.io/build-script.html), `build.rs`:\n```rust\nextern crate protobuf_build;\n\nuse std::env;\nuse std::path::PathBuf;\n\nfn main() {\n    let root = PathBuf::from(env::var(\"CARGO_MANIFEST_DIR\").unwrap());\n    let source = root.join(\"proto\");\n\n    let out = PathBuf::from(env::var(\"OUT_DIR\").unwrap());\n\n    let mut compiler = protobuf_build::Compiler::new(\u0026source, \u0026out);\n\n    compiler.compile(\"example.proto\").unwrap();\n}\n```\n\nThe easiest way to include the file is using the [mod_path compiler plugin](https://crates.io/crates/mod_path).\nUnfortunately, this requires Rust nightly. Once rust-lang/rust#18849 is fixed, this will be usable on stable rust.\n```rust\nmod_path! example (concat!(env!(\"OUT_DIR\"), \"/example.rs\"));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplietar%2Frust-protobuf-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplietar%2Frust-protobuf-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplietar%2Frust-protobuf-build/lists"}