{"id":17874267,"url":"https://github.com/modprog/quote-use","last_synced_at":"2025-03-21T22:31:49.461Z","repository":{"id":56933937,"uuid":"476062860","full_name":"ModProg/quote-use","owner":"ModProg","description":"Support `use` in procmacros hygienically","archived":false,"fork":false,"pushed_at":"2024-08-25T12:50:01.000Z","size":93,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T05:43:58.177Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ModProg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-03-30T21:52:31.000Z","updated_at":"2025-01-10T15:29:14.000Z","dependencies_parsed_at":"2024-10-28T11:53:30.385Z","dependency_job_id":null,"html_url":"https://github.com/ModProg/quote-use","commit_stats":{"total_commits":36,"total_committers":1,"mean_commits":36.0,"dds":0.0,"last_synced_commit":"3e076d4c7fc5767c04f98398d22db522874b2c91"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModProg%2Fquote-use","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModProg%2Fquote-use/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModProg%2Fquote-use/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ModProg%2Fquote-use/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ModProg","download_url":"https://codeload.github.com/ModProg/quote-use/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244880312,"owners_count":20525506,"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-10-28T11:08:15.790Z","updated_at":"2025-03-21T22:31:49.129Z","avatar_url":"https://github.com/ModProg.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Use statements in `quote!`\n[![Crates.io Version](https://img.shields.io/crates/v/quote-use.svg)](https://crates.io/crates/quote-use)\n[![CI](https://github.com/ModProg/quote-use/actions/workflows/test.yml/badge.svg)](https://github.com/ModProg/quote-use/actions/workflows/test.yml)\n[![Docs.rs Documentation](https://img.shields.io/docsrs/quote-use)](https://docs.rs/crate/quote-use)\n\n## Description\n\nMacro to simplify using Types in the [`quote!`](https://docs.rs/quote/latest/quote/macro.quote.html) macro.\n\n## Usage\n\nThe [`quote_use!`](https://docs.rs/quote-use/latest/quote_use/macro.quote_use.html) macro can be used just like [`quote!`](https://docs.rs/quote/latest/quote/macro.quote.html), but with the added functionality of\nadding use statements at the top:\n\n```rust\nquote_use!{\n    use std::fs::read;\n    \n    read(\"src/main.rs\")\n}\n```\n\nThis will expand to the equivalent statement using [`quote!`](https://docs.rs/quote/latest/quote/macro.quote.html):\n\n```rust\nquote!{\n    ::std::fs::read::read(\"src/main.rs\")\n}\n```\n\n### Prelude\n\nThis also allows to use contents of the rust prelude directly:\n\n```rust\nquote_use!{\n    Some(\"src/main.rs\")\n}\n```\n\n#### Overriding prelude\nWhen you want to use your own type instead of the prelude type this can be achieved by simply\nimporting it like so\n\n```rust\nquote_use!{\n    use anyhow::Result;\n                                                                                                             \n    Result\n}\n```\n\n#### Different preludes\n\nBy default [`quote_use!`](https://docs.rs/quote-use/latest/quote_use/macro.quote_use.html) uses the [std prelude](std::prelude) for [2021 edition](std::prelude::rust_2021), \nbut this can be configured via features, and also completely disabled.\n\n- **`prelude_std`**: Enables [`std::prelude::v1`](https://doc.rust-lang.org/nightly/std/prelude/v1/index.html)  (incompatible with `prelude_core`)\n- `prelude_core`: Enables [`core::prelude::v1`](https://doc.rust-lang.org/nightly/core/prelude/v1/index.html) (incompatible with `prelude_std`)\n- **`prelude_2021`**: Enables [`core::prelude::rust_2021`](https://doc.rust-lang.org/nightly/core/prelude/rust_2021/index.html) (requires either `prelude_std` or `prelude_core`)\n\n### Other quote macros\n\nThere are also variants for other quote macros from [syn](https://docs.rs/syn/latest/syn/) and [quote](https://docs.rs/quote/latest/quote/):\n\n- [`quote_use!`](https://docs.rs/quote-use/latest/quote_use/macro.quote_use.html) and [`quote_spanned_use!`](https://docs.rs/quote-use/latest/quote_use/macro.quote_spanned_use.html) as replacement for [`quote!`](https://docs.rs/quote/latest/quote/macro.quote.html) and\n[`quote_spanned!`](https://docs.rs/quote/latest/quote/macro.quote_spanned.html) respectively\n- [`parse_quote_use!`](https://docs.rs/quote-use/latest/quote_use/macro.parse_quote_use.html) and [`parse_quote_spanned_use!`](https://docs.rs/quote-use/latest/quote_use/macro.parse_quote_spanned_use.html) for [`parse_quote!`](https://docs.rs/syn/latest/syn/macro.parse_quote.html)\nand [`parse_quote_spanned!`](https://docs.rs/syn/latest/syn/macro.parse_quote_spanned.html)\n\n## Auto namespacing idents\n\nUntil [`Span::def_site`](https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.def_site) is stabilized, identifiers in e.g. let\nbindings in proc-macro expansions can collide with e.g. constants.\n\nTo circumvent this you can enable the feature `namespace_idents` which will replace all\nidentifiers with autonamespaced ones using the pattern `\"__{crate_name}_{ident}\"`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodprog%2Fquote-use","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmodprog%2Fquote-use","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmodprog%2Fquote-use/lists"}