{"id":13998178,"url":"https://github.com/tfpk/macrokata","last_synced_at":"2025-04-08T12:09:01.531Z","repository":{"id":61848192,"uuid":"553910680","full_name":"tfpk/macrokata","owner":"tfpk","description":"Learn Macros In Rust","archived":false,"fork":false,"pushed_at":"2024-07-13T11:22:36.000Z","size":2237,"stargazers_count":1133,"open_issues_count":8,"forks_count":73,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-01T10:18:17.521Z","etag":null,"topics":["macros","rust"],"latest_commit_sha":null,"homepage":"https://tfpk.github.io/macrokata","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/tfpk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2022-10-19T00:49:35.000Z","updated_at":"2025-03-28T14:13:32.000Z","dependencies_parsed_at":"2023-12-03T09:43:34.594Z","dependency_job_id":"ef796c44-41e5-4708-a63e-fb9733accd4f","html_url":"https://github.com/tfpk/macrokata","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/tfpk%2Fmacrokata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfpk%2Fmacrokata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfpk%2Fmacrokata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tfpk%2Fmacrokata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tfpk","download_url":"https://codeload.github.com/tfpk/macrokata/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838444,"owners_count":21004580,"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":["macros","rust"],"created_at":"2024-08-09T19:01:27.012Z","updated_at":"2025-04-08T12:09:01.510Z","avatar_url":"https://github.com/tfpk.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# MacroKata\n\nWelcome to MacroKata, a set of exercises which you can use to learn how to write\nmacros in Rust. When completing each task, there are three goals:\n\n - Get your code to compile without warnings or errors.\n - Get your code to \"work correctly\" (i.e. produce the same output)\n - Importantly, *generate the same code* as what the sample solution does.\n\nYou should complete the kata in order, as they increase in\ndifficulty, and depend on previous kata.\n\nThis set of exercises is written for people who have already spent some time\nprogramming in Rust. Before completing this, work through a Rust tutorial\nand build some small programs yourself. \n\n## Getting Started\n\nClone this repository:\n\n``` sh\n$ git clone https://www.github.com/tfpk/macrokata/\n```\n\nYou will also need to install the Rust \"nightly\" toolchain, so that we can show\nexpanded macros:\n\n``` sh\n$ rustup toolchain install nightly\n```\n\nNext, install `cargo-expand`:\n\n``` sh\n$ cargo install cargo-expand\n```\n\nBuild the main binary provided with this repo:\n\n``` sh\n$ cargo build --bin macrokata\n```\n\nYou can find the first kata (`my_first_macro`) inside `exercises/01_my_first_macro`.\nRead the [first chapter of the book](https://tfpk.github.io/macrokata/01_README.html)\nand get started by editing the `main.rs` file.\n\nTo compare your expanded code to the \"goal\", use the `test` subcommand:\n\n``` sh\n$ cargo run -- test 01_my_first_macro\n```\n\nYou can run your own code as follows:\n\n``` sh\n$ cargo run --bin 01_my_first_macro\n```\n\n## How To Learn About Procedural Macros\n\nI was originally planning to expand `macrokata` into discussing procedural\nmacros as well. As I was researching that, I found dtolnay's superlative [Proc\nMacro Workshop](https://github.com/dtolnay/proc-macro-workshop).\n[Jon Gjengset's video on proc-macros](https://www.youtube.com/watch?v=geovSK3wMB8)\nis also a phenomenal resource (despite its length).\n\nI've put my attempt to write something like that on hold because I think the\nabove is better in every way. Do file an issue if there's something that we\ncould do here to complement that workshop though.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftfpk%2Fmacrokata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftfpk%2Fmacrokata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftfpk%2Fmacrokata/lists"}