{"id":22747423,"url":"https://github.com/dekirisu/buns","last_synced_at":"2025-04-12T22:41:49.686Z","repository":{"id":262252181,"uuid":"886662379","full_name":"dekirisu/buns","owner":"dekirisu","description":"Create simple code templates - basically macro_rules lite","archived":false,"fork":false,"pushed_at":"2025-01-12T11:51:26.000Z","size":13,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T16:48:50.784Z","etag":null,"topics":["proc-macro","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dekirisu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2024-11-11T11:33:57.000Z","updated_at":"2025-03-11T08:31:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"a24f18b0-4e3d-46b5-b205-2a24ef77d96c","html_url":"https://github.com/dekirisu/buns","commit_stats":null,"previous_names":["dekirisu/buns"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekirisu%2Fbuns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekirisu%2Fbuns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekirisu%2Fbuns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dekirisu%2Fbuns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dekirisu","download_url":"https://codeload.github.com/dekirisu/buns/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643045,"owners_count":21138353,"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":["proc-macro","rust","rust-lang"],"created_at":"2024-12-11T03:15:38.373Z","updated_at":"2025-04-12T22:41:49.674Z","avatar_url":"https://github.com/dekirisu.png","language":"Rust","readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/user-attachments/assets/c265f7e7-f8c1-43f1-b9de-370bf7d2cd1b\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/dekirisu/buns\" style=\"position:relative\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-dekirisu/buns-ee6677\"\u003e\u003c/a\u003e\u003ca href=\"https://crates.io/crates/buns\" style=\"position:relative\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/buns\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nA simple way to write repeatable code anywhere, by defining buns and toppings. 🍞\n\n## Sandwich / Compose\nThis can be seen as `format!()`, but for code:\n1. **Buns**: Write the code, use `^0 ^1 .. ^N` as (Topping) placeholders\n2. **Topping**: Write code inserts: `#0^1^..^N`, where numbers = any code\n3. **Why tho?** The point is, you can repeat 2. and make infinite sandwiches. 🥪\n\n```rust\nbuns::sandwich!{ \n    const ^0: u32 = ^1; // Buns\n    #TEST^10 #OMEGA^59  // Toppings\n}\n// Will generate:\n// const TEST: u32 = 10;\n// const OMEGA: u32 = 59;\n```\n\n## Prepare / Preset\nThis can be seen as a simplified `macro_rules!{}`, where you prepare named **Buns** and add the **Toppings** later using the generated macro (The code (Buns) is automatically added to the macro documentation):\n```rust\nbuns::prepare!{\n    burger           // Name\n    let a = ^0 + ^0; // Buns\n    println!(\"{a}\"); // \"\n}\n\nfn main(){\n    burger!{#1 #2 #4+4 #4 #2*2} // Toppings\n    // prints: 2 4 16 8 8\n}\n```\n\n## Flexibility\nYou can use any other magical token macro like [paste](https://github.com/dtolnay/paste) to add functionality:\n```rust\nbuns::sandwich!{\n    paste::paste!{const [\u003c^1 _ ^0:upper\u003e]: ^0 = ^2;}\n    #u32^BREAD^100 #f32^BREAD^12.0\n}\n// Will generate:\n// const BREAD_U32: u32 = 100;\n// const BREAD_F32: f32 = 12.9;\n```\n\n---\n### License\n\u003csup\u003e\nLicensed under either of \u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version\n2.0\u003c/a\u003e or \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e at your option.\n\u003c/sup\u003e\n\u003cbr\u003e\n\u003csub\u003e\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this crate by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdekirisu%2Fbuns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdekirisu%2Fbuns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdekirisu%2Fbuns/lists"}