{"id":16678252,"url":"https://github.com/celaus/rust-macros","last_synced_at":"2025-10-09T18:04:36.869Z","repository":{"id":68196202,"uuid":"190741739","full_name":"celaus/rust-macros","owner":"celaus","description":"Simple macro examples","archived":false,"fork":false,"pushed_at":"2019-06-07T12:47:22.000Z","size":3,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-13T07:11:17.027Z","etag":null,"topics":["blog","rust","rust-macro","x5ff"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/celaus.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-07T12:43:24.000Z","updated_at":"2024-03-24T23:25:31.000Z","dependencies_parsed_at":"2023-04-29T08:47:05.095Z","dependency_job_id":null,"html_url":"https://github.com/celaus/rust-macros","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/celaus/rust-macros","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celaus%2Frust-macros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celaus%2Frust-macros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celaus%2Frust-macros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celaus%2Frust-macros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/celaus","download_url":"https://codeload.github.com/celaus/rust-macros/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celaus%2Frust-macros/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001911,"owners_count":26083225,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["blog","rust","rust-macro","x5ff"],"created_at":"2024-10-12T13:28:52.378Z","updated_at":"2025-10-09T18:04:36.854Z","avatar_url":"https://github.com/celaus.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Collection Of Simple Macro Examples\n\nThis is part of a blog post over at [https://blog.x5ff.xyz](https://blog.x5ff.xyz). Run it like that (the warnings are part of the fun):\n\n~~~sh\n$ cargo test\n\n   Compiling rust-macros v0.1.0 (rust-macros)\nwarning: unused macro definition\n  --\u003e src/lib.rs:7:1\n   |\n7  | / macro_rules! calc  {\n8  | |   (two) =\u003e { 1 + 1 };\n9  | |   (three) =\u003e { 1 + 2 }\n10 | | }\n   | |_^\n   |\n   = note: #[warn(unused_macros)] on by default\n\nwarning: unused macro definition\n  --\u003e src/lib.rs:12:1\n   |\n12 | / macro_rules! repeat_n_times {\n13 | |     ($n:expr, $text:expr) =\u003e {(0..$n).map(|_| format!(\"{}\", $text)).collect::\u003cVec\u003cString\u003e\u003e()}\n14 | | }\n   | |_^\n\nwarning: unused macro definition\n  --\u003e src/lib.rs:21:1\n   |\n21 | / macro_rules! handler {\n22 | |     ($i: ident, $body: block) =\u003e {\n23 | |         fn $i () -\u003e Response $body\n24 | |     }\n25 | | }\n   | |_^\n\nwarning: unused import: `std::collections::BTreeSet`\n  --\u003e src/lib.rs:27:5\n   |\n27 | use std::collections::BTreeSet;\n   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^\n   |\n   = note: #[warn(unused_imports)] on by default\n\nwarning: unused macro definition\n  --\u003e src/lib.rs:29:1\n   |\n29 | / macro_rules! set {\n30 | |  ( $( $item:expr ),* ) =\u003e {\n31 | |         {\n32 | |             let mut s = BTreeSet::new();\n...  |\n38 | |     };\n39 | | }\n   | |_^\n\n    Finished dev [unoptimized + debuginfo] target(s) in 1.12s\n     Running target/debug/deps/rust_macros-f64009a11dc6e1e2\n\nrunning 6 tests\ntest tests::test_calc ... ok\ntest tests::test_req_handler ... ok\ntest tests::test_repeat ... ok\ntest tests::test_set ... ok\ntest tests::test_two ... ok\ntest tests::test_kv ... ok\n\ntest result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\n\n   Doc-tests rust-macros\n\nrunning 0 tests\n\ntest result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\n~~~\n\n# License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcelaus%2Frust-macros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcelaus%2Frust-macros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcelaus%2Frust-macros/lists"}