{"id":20145875,"url":"https://github.com/usagi/retrieve","last_synced_at":"2025-04-09T19:20:55.576Z","repository":{"id":62444370,"uuid":"486293202","full_name":"usagi/retrieve","owner":"usagi","description":null,"archived":false,"fork":false,"pushed_at":"2022-05-11T10:00:03.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T21:11:24.843Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usagi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-27T17:41:29.000Z","updated_at":"2023-02-10T16:25:43.000Z","dependencies_parsed_at":"2022-11-01T23:33:44.700Z","dependency_job_id":null,"html_url":"https://github.com/usagi/retrieve","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Fretrieve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Fretrieve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Fretrieve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usagi%2Fretrieve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usagi","download_url":"https://codeload.github.com/usagi/retrieve/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248095073,"owners_count":21046784,"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-11-13T22:18:33.858Z","updated_at":"2025-04-09T19:20:55.545Z","avatar_url":"https://github.com/usagi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![github]](https://github.com/usagi/retrieve)\u0026ensp;[![crates-io]](https://crates.io/crates/retrieve)\u0026ensp;[![docs-rs]](https://docs.rs/retrieve)\u003cbr\u003e\n[![Build Status](https://travis-ci.org/usagi/retrieve.svg?branch=master)](https://travis-ci.org/usagi/retrieve)\n\n[github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\n[crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge\u0026labelColor=555555\u0026logo=rust\n[docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logoColor=white\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K\n\n# retrieve\n\n`mod x` and `use x::*` pattern syntax sugar of the proc-macro attribute.\n\n- `retrieve::`\n  - `mod_use` =\u003e `mod x; use x::*;` for a module internal.\n  - `pub_mod_use` =\u003e `pub mod x; use x::*` for a public nested modules.\n  - `mod_pub_use` =\u003e `mod x; pub use x::*` for a public flatten modules with separated source writting.\n  - `pub_mod_pub_use` =\u003e `pub x; pub use x::x` for a public nested modules with flatten alias in the root.\n\nI am tired of writing the `mod x; use x::*;` pattern over and over again for structured beatiful source code!😝 And I like the stylish attribute proc-macro style syntax sugars.💖\n\n## Example: [examples/](examples/)\n\n- src/\n  - main.rs\n  - x.rs ; Or it can move to x/mod.rs if you like module-name/mod.rs style.\n  - x/\n    - a.rs ; `crate::x::a::*`\n    - b.rs ; `crate::x::b::*`\n\n1. main.rs:\n\n```rust\nuse retrieve::*;\n\n#[mod_pub_use(x)] // \u003c-- here!; it's the same as `mod x; pub use x::*;`\nfn main()\n{\n // `X` from x::X\n let x = X {\n  a: 1,\n  b: 2\n };\n\n // And it from '2. x.rs'; `.a()` from the trait of `x::a::A` and `.b()` from the trait of `x::b::B`\n println!(\"{:?}\", x.a() + x.b());\n}\n```\n\n2. x.rs:\n\n```rust\nuse retrieve::*;\n\n#[mod_pub_use(a, b)] // \u003c-- here!; it's the same as `mod a; pub use a::*;` and `mod b; pub use b::*;`\npub struct X\n{\n pub a: i32,\n pub b: i32\n}\n```\n\n## for Debuggin\n\n`retrieve` has `print` feature. It will be show a part of evaluated syntax:\n\neg. Run the example with `print` feature:\n\n```sh\ncargo run --example work_arround --features print\n```\n\nThen, you will get something like it in the build messages:\n\n```sh\n   Compiling retrieve v1.0.1 (C:\\Users\\usagi\\tmp\\retrieve)\n[(proc-macro)retrieve::mod_pub_use+print]\nmod x; pub use x::*;\nfn main()\n{ let x = X :: new(1) ; println! (\"{:?} {:?}\", x.a(), x.to_string()) ; }\n[(proc-macro)retrieve::mod_pub_use+print]\nmod a; pub use a::*;\nmod new; pub use new::*;\nmod _impl_already_traits; pub use _impl_already_traits::*;\npub struct X { a : i32 }\n[(proc-macro)retrieve::mod_pub_use+print]\nmod display; pub use display::*;\nuse super :: X ;\n    Finished dev [unoptimized + debuginfo] target(s) in 1.41s\n     Running `target\\debug\\examples\\work_arround.exe`\n1 \"One!\"\n```\n\n## LICENSE\n\n- [MIT](LICENSE.md)\n\n## Author\n\n- USAGI.NETWORK / Usagi Ito \u003chttps://github.com/usagi/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusagi%2Fretrieve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusagi%2Fretrieve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusagi%2Fretrieve/lists"}