{"id":14992020,"url":"https://github.com/natanalt/zig2rs","last_synced_at":"2025-09-25T14:30:36.516Z","repository":{"id":104221886,"uuid":"458335889","full_name":"natanalt/zig2rs","owner":"natanalt","description":"use zig code in rust - a medium effort shitpost","archived":false,"fork":false,"pushed_at":"2022-02-11T20:52:18.000Z","size":100,"stargazers_count":18,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-25T16:09:06.706Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/natanalt.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":"2022-02-11T20:48:11.000Z","updated_at":"2023-07-06T18:39:47.000Z","dependencies_parsed_at":"2023-07-15T14:32:46.622Z","dependency_job_id":null,"html_url":"https://github.com/natanalt/zig2rs","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/natanalt%2Fzig2rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanalt%2Fzig2rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanalt%2Fzig2rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanalt%2Fzig2rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/natanalt","download_url":"https://codeload.github.com/natanalt/zig2rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234200156,"owners_count":18795139,"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-09-24T15:00:39.395Z","updated_at":"2025-09-25T14:30:36.192Z","avatar_url":"https://github.com/natanalt.png","language":"Rust","funding_links":[],"categories":["FFI Bindings"],"sub_categories":[],"readme":"# ✨ *zig2rs* ✨\nHave you ever wanted to use two of the objectively best programming languages out there - Rust and Zig - at the same time? Has linking applications through C ABI tired you? Well then look no further, as my solution will revolutionise the world of software development!\n\n## Why?\n![Ferris the Crab and Zero the Ziguana cuddling on a raft](truelove.png)\n\n## How?\nIt's a small macro you can use:\n```rust\nunsafe fn print_string(ptr: *const u8, len: usize) {\n    let slice = std::slice::from_raw_parts(ptr, len);\n    let string = std::str::from_utf8(slice).unwrap();\n    println!(\"{}\", string);\n}\n\nzig2rs! {\n    fn hello_world(times: usize) void {\n        const message = \"this is a crime\";\n        var i: usize = 0;\n        while (i \u003c times) : (i += 1) {\n            print_string(message.ptr, message.len);\n        }\n    }\n}\n\nfn main() {\n    unsafe {\n        hello_world(3);\n    }\n}\n```\nYou can't actually use any good features Zig has going for itself, but shhh be quiet. This example is about everything this thing can do, and anything else will anger the compiler.\n\n## Who?\nhi, [I](https://github.com/natanalt) did this medium effort shitpost\n\n## What's next?\nSomeday I may write a proper compiler using procedural macros instead of `macro_rules!` which would allow for much greater flexibility, lack of which is why this macro is so limited\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatanalt%2Fzig2rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatanalt%2Fzig2rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatanalt%2Fzig2rs/lists"}