{"id":13822622,"url":"https://github.com/taiki-e/pin-project","last_synced_at":"2025-05-13T19:18:07.879Z","repository":{"id":41467362,"uuid":"164668916","full_name":"taiki-e/pin-project","owner":"taiki-e","description":"A crate for safe and ergonomic pin-projection.","archived":false,"fork":false,"pushed_at":"2025-03-20T18:31:26.000Z","size":2557,"stargazers_count":654,"open_issues_count":4,"forks_count":36,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-06T00:04:07.931Z","etag":null,"topics":["no-std","proc-macro","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/pin-project","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/taiki-e.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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,"zenodo":null},"funding":{"github":"taiki-e"}},"created_at":"2019-01-08T14:42:10.000Z","updated_at":"2025-05-05T15:09:53.000Z","dependencies_parsed_at":"2023-11-29T15:28:24.695Z","dependency_job_id":"ba21d75c-9a8d-4dbc-ac35-77c4e35c031c","html_url":"https://github.com/taiki-e/pin-project","commit_stats":{"total_commits":1114,"total_committers":12,"mean_commits":92.83333333333333,"dds":"0.050269299820466795","last_synced_commit":"3fa6e9242c9f3b9646a869555be7a38bbbafbda7"},"previous_names":[],"tags_count":86,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fpin-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fpin-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fpin-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fpin-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taiki-e","download_url":"https://codeload.github.com/taiki-e/pin-project/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252788520,"owners_count":21804285,"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":["no-std","proc-macro","rust"],"created_at":"2024-08-04T08:02:09.479Z","updated_at":"2025-05-13T19:18:07.841Z","avatar_url":"https://github.com/taiki-e.png","language":"Rust","readme":"# pin-project\n\n[![crates.io](https://img.shields.io/crates/v/pin-project?style=flat-square\u0026logo=rust)](https://crates.io/crates/pin-project)\n[![docs.rs](https://img.shields.io/badge/docs.rs-pin--project-blue?style=flat-square\u0026logo=docs.rs)](https://docs.rs/pin-project)\n[![license](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue?style=flat-square)](#license)\n[![msrv](https://img.shields.io/badge/msrv-1.56-blue?style=flat-square\u0026logo=rust)](https://www.rust-lang.org)\n[![github actions](https://img.shields.io/github/actions/workflow/status/taiki-e/pin-project/ci.yml?branch=main\u0026style=flat-square\u0026logo=github)](https://github.com/taiki-e/pin-project/actions)\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:start:src/lib.rs --\u003e\n\nA crate for safe and ergonomic [pin-projection].\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\npin-project = \"1\"\n```\n\n## Examples\n\n[`#[pin_project]`][`pin_project`] attribute creates projection types\ncovering all the fields of struct or enum.\n\n```rust\nuse std::pin::Pin;\n\nuse pin_project::pin_project;\n\n#[pin_project]\nstruct Struct\u003cT, U\u003e {\n    #[pin]\n    pinned: T,\n    unpinned: U,\n}\n\nimpl\u003cT, U\u003e Struct\u003cT, U\u003e {\n    fn method(self: Pin\u003c\u0026mut Self\u003e) {\n        let this = self.project();\n        let _: Pin\u003c\u0026mut T\u003e = this.pinned; // Pinned reference to the field\n        let _: \u0026mut U = this.unpinned; // Normal reference to the field\n    }\n}\n```\n\n[*code like this will be generated*][struct-default-expanded]\n\nTo use `#[pin_project]` on enums, you need to name the projection type\nreturned from the method.\n\n```rust\nuse std::pin::Pin;\n\nuse pin_project::pin_project;\n\n#[pin_project(project = EnumProj)]\nenum Enum\u003cT, U\u003e {\n    Pinned(#[pin] T),\n    Unpinned(U),\n}\n\nimpl\u003cT, U\u003e Enum\u003cT, U\u003e {\n    fn method(self: Pin\u003c\u0026mut Self\u003e) {\n        match self.project() {\n            EnumProj::Pinned(x) =\u003e {\n                let _: Pin\u003c\u0026mut T\u003e = x;\n            }\n            EnumProj::Unpinned(y) =\u003e {\n                let _: \u0026mut U = y;\n            }\n        }\n    }\n}\n```\n\n[*code like this will be generated*][enum-default-expanded]\n\nSee [`#[pin_project]`][`pin_project`] attribute for more details, and\nsee [examples] directory for more examples and generated code.\n\n## Related Projects\n\n- [pin-project-lite]: A lightweight version of pin-project written with declarative macros.\n\n[enum-default-expanded]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/enum-default-expanded.rs\n[examples]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/README.md\n[pin-project-lite]: https://github.com/taiki-e/pin-project-lite\n[pin-projection]: https://doc.rust-lang.org/std/pin/index.html#projections-and-structural-pinning\n[struct-default-expanded]: https://github.com/taiki-e/pin-project/blob/HEAD/examples/struct-default-expanded.rs\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:end --\u003e\n\n[`pin_project`]: https://docs.rs/pin-project/latest/pin_project/attr.pin_project.html\n\n## License\n\nLicensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or\n[MIT license](LICENSE-MIT) at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n","funding_links":["https://github.com/sponsors/taiki-e"],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fpin-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaiki-e%2Fpin-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fpin-project/lists"}