{"id":16752812,"url":"https://github.com/luser/integrating-rust-into-existing-projects","last_synced_at":"2026-02-02T01:33:32.133Z","repository":{"id":137590147,"uuid":"73832511","full_name":"luser/integrating-rust-into-existing-projects","owner":"luser","description":null,"archived":false,"fork":false,"pushed_at":"2017-12-01T11:00:11.000Z","size":2,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-22T05:34:04.799Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/luser.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-11-15T16:24:52.000Z","updated_at":"2017-12-21T14:48:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"192f7c79-d0ae-487e-99af-031287a7d82d","html_url":"https://github.com/luser/integrating-rust-into-existing-projects","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/luser/integrating-rust-into-existing-projects","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luser%2Fintegrating-rust-into-existing-projects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luser%2Fintegrating-rust-into-existing-projects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luser%2Fintegrating-rust-into-existing-projects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luser%2Fintegrating-rust-into-existing-projects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luser","download_url":"https://codeload.github.com/luser/integrating-rust-into-existing-projects/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luser%2Fintegrating-rust-into-existing-projects/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28999800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T01:32:03.847Z","status":"ssl_error","status_checked_at":"2026-02-02T01:32:03.458Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-13T02:48:11.207Z","updated_at":"2026-02-02T01:33:32.119Z","avatar_url":"https://github.com/luser.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Integrating Rust into Existing Projects\n\nI'd like to write up some documentation and best practices for integrating\n[Rust](https://www.rust-lang.org/) into existing software projects. I expect\nmost of the focus will be on integrating into C and C++ projects, but there's\ncertainly room for information about integrating Rust into projects written in\nother languages.\n\nAs a first cut I'm just going to link the existing work I know about in this\nspace.\n\n## Firefox\n\nI've been heavily involved in the planning work of integrating Rust code into Firefox. We are shipping some Rust code (an mp4 parser) currently, but it's not enabled by default if you build Firefox from source. There are large in-progress\nprojects to use parts of [Servo](https://servo.org/) in Firefox which will\nbring in a lot more Rust code. These projects are all working with the\ninfrastructure we built, so our foundation seems sound.\n\n### Build System\n\nFirefox uses autoconf and GNU make (not automake), but with a lot of custom\nscaffolding. We elected to build our Rust code using `cargo` to make things\nwork as expected for Rust developers. This has worked very well once we\nironed out a few wrinkles. There's [some documentation](https://firefox-source-docs.mozilla.org/build/buildsystem/rust.html)\non how to add new Rust code to Firefox available. Under the hood the build\nsystem mostly just [invokes cargo](https://dxr.mozilla.org/mozilla-central/rev/5e76768327660437bf3486554ad318e4b70276e1/config/rules.mk#935)\nto build a static library containing all the Rust code, then links that\ninto the final binary.\n\n### Vendoring\n\nWe elected to vendor all Rust crate dependencies from crates.io into our\nrepository, since the historical position has been that the Firefox build\nshould not need to touch the internet. We used [`cargo vendor`](https://github.com/alexcrichton/cargo-vendor/) to do so. This requires the cargo that\nshipped with Rust 1.12 with support for source replacement.\n\n## VLC\n\nGeoffroy Couprie [gave a talk at RustConf 2016](http://dev.unhandledexpression.com/slides/rustconf-2016/vlc/)\nabout integrating Rust into the VLC media player. He wrote [a VLC plugin](https://github.com/Geal/rust-vlc-demux) in Rust.\n\n### Build System\n\nVLC uses automake. Geoffroy integrated the Rust code as a static library,\nbuilt by cargo, using standard automake boilerplate. (TODO: expand on this)\n\n### Integration with existing C APIs\n\nA large part of the presentation was on the challenges of integrating with the\nexisting C APIs. TODO: write up some of that.\n\n## GStreamer\n\nSebastian Dröge [gave a talk at GStreamer Conference 2016](https://gstconf.ubicast.tv/videos/corroded-pipelines-or-how-to-write-gstreamer-element-in-rust/)\non writing a GStreamer element in Rust. He also wrote a pair of blog posts on it: [one](https://coaxion.net/blog/2016/05/writing-gstreamer-plugins-and-elements-in-rust/), [two](https://coaxion.net/blog/2016/09/writing-gstreamer-elements-in-rust-part-2-dont-panic-we-have-better-assertions-now-and-other-updates/).\nThe [GStreamer plugin he wrote](https://github.com/sdroege/rsplugin) is available.\n\nTODO: write up some of the interesting bits.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluser%2Fintegrating-rust-into-existing-projects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluser%2Fintegrating-rust-into-existing-projects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluser%2Fintegrating-rust-into-existing-projects/lists"}