{"id":19094880,"url":"https://github.com/zahash/newtyperef","last_synced_at":"2026-01-07T18:36:46.768Z","repository":{"id":257594804,"uuid":"858845196","full_name":"zahash/newtyperef","owner":"zahash","description":"newtyperef","archived":false,"fork":false,"pushed_at":"2024-09-19T07:22:34.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T21:17:18.063Z","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/zahash.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":"2024-09-17T16:23:17.000Z","updated_at":"2024-09-19T07:22:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"54567f1f-8700-4691-804d-e347dc8e09e8","html_url":"https://github.com/zahash/newtyperef","commit_stats":null,"previous_names":["zahash/newtyperef"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahash%2Fnewtyperef","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahash%2Fnewtyperef/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahash%2Fnewtyperef/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahash%2Fnewtyperef/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zahash","download_url":"https://codeload.github.com/zahash/newtyperef/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249514278,"owners_count":21284508,"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-09T03:31:55.082Z","updated_at":"2026-01-07T18:36:46.743Z","avatar_url":"https://github.com/zahash.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cpre\u003e\n███╗   ██╗███████╗██╗    ██╗████████╗██╗   ██╗██████╗ ███████╗██████╗ ███████╗███████╗\n████╗  ██║██╔════╝██║    ██║╚══██╔══╝╚██╗ ██╔╝██╔══██╗██╔════╝██╔══██╗██╔════╝██╔════╝\n██╔██╗ ██║█████╗  ██║ █╗ ██║   ██║    ╚████╔╝ ██████╔╝█████╗  ██████╔╝█████╗  █████╗  \n██║╚██╗██║██╔══╝  ██║███╗██║   ██║     ╚██╔╝  ██╔═══╝ ██╔══╝  ██╔══██╗██╔══╝  ██╔══╝  \n██║ ╚████║███████╗╚███╔███╔╝   ██║      ██║   ██║     ███████╗██║  ██║███████╗██║     \n╚═╝  ╚═══╝╚══════╝ ╚══╝╚══╝    ╚═╝      ╚═╝   ╚═╝     ╚══════╝╚═╝  ╚═╝╚══════╝╚═╝     \n------------------------------------------------------------------------------\nGenerate custom newtype reference types\n\u003c/pre\u003e\n\n[![Crates.io](https://img.shields.io/crates/v/newtyperef.svg)](https://crates.io/crates/newtyperef)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\u003c/div\u003e\n\n## 🚀 Installation\n\ninclude it in your `Cargo.toml` under `[dependencies]`\n\n```toml\nnewtyperef = \"*\"\n```\n\n## 🧑‍💻 Usage examples\n\n### Basic Usage\n\n```rust\nuse newtyperef::newtyperef;\n\n#[newtyperef]\npub struct Name(pub String);\n\nfn main() {\n    let mut name = Name(\"X Æ A-12\".into());\n\n    let name_ref: NameRef\u003c'_\u003e = name.as_ref();\n    let name_ref_inner: \u0026String = name_ref.deref();\n\n    let mut name_mut: NameRefMut\u003c'_\u003e = name.as_mut();\n    let name_mut_inner: \u0026String = name_mut.deref();\n    let name_mut_inner: \u0026mut String = name_mut.deref_mut();\n}\n```\n\n### Customizing Reference Types\n\n```rust\nuse newtyperef::newtyperef;\n\n#[newtyperef(ref = str, mut = str)]\npub struct Name(pub String);\n\nfn name_example() {\n    let mut name = Name(\"X Æ A-12\".into());\n\n    let name_ref: NameRef\u003c'_\u003e = name.as_ref();\n    let name_ref_inner: \u0026str = name_ref.deref();\n\n    let mut name_mut: NameRefMut\u003c'_\u003e = name.as_mut();\n    let name_mut_inner: \u0026str = name_mut.deref();\n    let name_mut_inner: \u0026mut str = name_mut.deref_mut();\n}\n\n\n#[newtyperef(ref = [String])]\npub struct Emails(pub Vec\u003cString\u003e);\n\nfn emails_example() {\n    let mut emails = Emails(vec![\"a@a.com\".into(), \"b@b.com\".into()]);\n\n    let emails_ref: EmailsRef\u003c'_\u003e = emails.as_ref();\n    let emails_ref_inner: \u0026[String] = emails_ref.deref();\n\n    let mut emails_mut: EmailsRefMut\u003c'_\u003e = emails.as_mut();\n    let emails_mut_inner: \u0026Vec\u003cString\u003e = emails_mut.deref();\n    let emails_mut_inner: \u0026mut Vec\u003cString\u003e = emails_mut.deref_mut();\n}\n\n```\n\n## 🌟 Connect with Us\n\nM. Zahash – zahash.z@gmail.com\n\nDistributed under the MIT license. See `LICENSE` for more information.\n\n[https://github.com/zahash/](https://github.com/zahash/)\n\n## 🤝 Contribute to `newtyperef`!\n\n1. Fork it (\u003chttps://github.com/zahash/newtyperef/fork\u003e)\n2. Create your feature branch (`git checkout -b feature/fooBar`)\n3. Commit your changes (`git commit -am 'Add some fooBar'`)\n4. Push to the branch (`git push origin feature/fooBar`)\n5. Create a new Pull Request\n\n## ❤️ Show Some Love!\n\nIf you find `newtyperef` helpful and enjoy using it, consider giving it a [⭐ on GitHub!](https://github.com/zahash/newtyperef/stargazers) Your star is a gesture of appreciation and encouragement for the continuous improvement of `newtyperef`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzahash%2Fnewtyperef","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzahash%2Fnewtyperef","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzahash%2Fnewtyperef/lists"}