{"id":15762354,"url":"https://github.com/williamvenner/inline-rust","last_synced_at":"2025-05-06T20:45:03.536Z","repository":{"id":57634539,"uuid":"430860956","full_name":"WilliamVenner/inline-rust","owner":"WilliamVenner","description":"A cursed macro that compiles and executes Rust and spits the output directly into your Rust code","archived":false,"fork":false,"pushed_at":"2022-11-26T13:29:39.000Z","size":9,"stargazers_count":30,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-06T02:41:25.421Z","etag":null,"topics":["embed","inline","macro","proc-macro","procmacro","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/inline-rust/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WilliamVenner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-22T20:50:17.000Z","updated_at":"2025-02-10T11:00:00.000Z","dependencies_parsed_at":"2023-01-23T15:46:22.563Z","dependency_job_id":null,"html_url":"https://github.com/WilliamVenner/inline-rust","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/WilliamVenner%2Finline-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WilliamVenner%2Finline-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WilliamVenner%2Finline-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WilliamVenner%2Finline-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WilliamVenner","download_url":"https://codeload.github.com/WilliamVenner/inline-rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252769127,"owners_count":21801373,"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":["embed","inline","macro","proc-macro","procmacro","rust"],"created_at":"2024-10-04T11:08:48.108Z","updated_at":"2025-05-06T20:45:03.505Z","avatar_url":"https://github.com/WilliamVenner.png","language":"Rust","readme":"[![crates.io](https://img.shields.io/crates/v/inline-rust.svg)](https://crates.io/crates/inline-rust)\n[![docs.rs](https://docs.rs/inline-rust/badge.svg)](https://docs.rs/inline-rust/)\n[![license](https://img.shields.io/crates/l/inline-rust)](https://github.com/WilliamVenner/inline-rust/blob/master/LICENSE)\n\n# inline-rust\n\nThis is a stupid macro inspired by [`inline-python`](https://github.com/fusion-engineering/inline-python) that compiles and executes Rust and spits the output directly into your Rust code.\n\nThere is a use case of using it to evaluate advanced \"const\" expressions, see the example below... if you dare.\n\n# Usage\n\n```toml\n[dependencies]\ninline-rust = \"*\"\n```\n\n# Example\n\n```rust\n// Compiles using cargo\nconst CONST_HASH: \u0026'static str = inline_rust!(\n    r#\"\n        [dependencies]\n        sha2 = \"0.9.8\"\n    \"#,\n    {\n        use sha2::Digest;\n\n        let mut sum: i32 = 0;\n        for n in 0..30 {\n            sum += n;\n        }\n\n        format!(\"\\\"{:x}\\\"\", sha2::Sha256::digest(\u0026sum.to_ne_bytes()))\n    }\n);\n\n// Compiles using rustc\nconst CONST_FOR_LOOP: i32 = inline_rust!({\n    let mut sum: i32 = 0;\n    for n in 0..30 {\n        sum += n;\n    }\n    format!(\"{}\", sum)\n});\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamvenner%2Finline-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliamvenner%2Finline-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamvenner%2Finline-rust/lists"}