{"id":17925343,"url":"https://github.com/blyxyas/typed_macros","last_synced_at":"2025-03-24T03:31:05.744Z","repository":{"id":61272049,"uuid":"549921546","full_name":"blyxyas/typed_macros","owner":"blyxyas","description":"Add types to your macros arguments in Rust","archived":false,"fork":false,"pushed_at":"2022-10-14T22:44:26.000Z","size":34,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T01:11:35.056Z","etag":null,"topics":["crate","macros","rust","rust-lang","rust-macro"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/typed_macros","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/blyxyas.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":"2022-10-12T00:08:57.000Z","updated_at":"2024-06-13T01:25:07.000Z","dependencies_parsed_at":"2022-10-14T02:12:21.515Z","dependency_job_id":null,"html_url":"https://github.com/blyxyas/typed_macros","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/blyxyas%2Ftyped_macros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blyxyas%2Ftyped_macros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blyxyas%2Ftyped_macros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blyxyas%2Ftyped_macros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blyxyas","download_url":"https://codeload.github.com/blyxyas/typed_macros/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245204493,"owners_count":20577361,"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":["crate","macros","rust","rust-lang","rust-macro"],"created_at":"2024-10-28T20:53:30.456Z","updated_at":"2025-03-24T03:31:05.486Z","avatar_url":"https://github.com/blyxyas.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typed macros\nA traditional macro can't natively have arguments with type, they can only\naccept a handful of meta types (`expr`, `ident`, `vis`...), with this crate\nyou can explicitely say the type of the argument you want the macro to take.\n\n## Usage\n\nAdd the following dependency to your Cargo.toml file:\n\n```\n[dependencies]\ntyped_macros = \"1.0.6\"\n```\n\nAnd check the [documentation](https://docs.rs/typed_macros/latest/typed_macros/) on how to use it.\n\n## Example\n\n```rust\n#![feature(macro_metavar_expr)]\nuse typed_macros::macrox;\n\nmacrox! {\n\t/// You can even use attributes!\n\t#[macro_export]\n\tmacro foo(bar: String) {\n\t\t// Do something with bar...\n\t}\n}\n\nfn main() {\n\tfoo!(String::from(\"Some string\")); // \u003c- This won't throw an error.\n\tfoo!(9u32); // \u003c- This will throw an error.\n}\n```\n\nThe main macro is [`macrox`][macrox], it takes an input like `macro name(arg1: type1, arg2: type2) { /* Code */ }` Take a look to the [documentation][macrox] for a more in-depth approach to this macro. (Including multibranched macros!)\n\n## Testing\n\nYou can run `cargo test` in the root directory, but you'll only see an error (an **intended** error) because the macro `this_should_warn` was asking for a `u32` type, and the test tried to use it with a `String`.\n\n[macrox]: https://docs.rs/typed_macros/latest/typed_macros/macro.macrox.html\n\n## Contributing\n\nContributing is always welcomed, both in the form of code, documentation, ideas, etc... As the project is very simple there isn't a guide for contributing. If this is your first time contributing to an open source project maybe [this guide](https://github.com/firstcontributions/first-contributions) helps you.\n\n## Stargazers\n\nThanks to all the people that starred the project, my monkey brain likes when number grow big.\n\n[![Stargazers repo roster for @blyxyas/typed_macros](https://reporoster.com/stars/blyxyas/typed_macros)](https://github.com/blyxyas/typed_macros/stargazers)\n\n## License\n\nThis software uses the MIT license. More info about this license is in the `LICENSE` file.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblyxyas%2Ftyped_macros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblyxyas%2Ftyped_macros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblyxyas%2Ftyped_macros/lists"}