{"id":13822477,"url":"https://github.com/taiki-e/pin-project-lite","last_synced_at":"2026-02-27T17:31:25.935Z","repository":{"id":41474494,"uuid":"216847853","full_name":"taiki-e/pin-project-lite","owner":"taiki-e","description":"A lightweight version of pin-project written with declarative macros.","archived":false,"fork":false,"pushed_at":"2025-03-20T18:31:32.000Z","size":607,"stargazers_count":243,"open_issues_count":7,"forks_count":17,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-31T13:05:34.771Z","etag":null,"topics":["no-std","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/pin-project-lite","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},"funding":{"github":"taiki-e"}},"created_at":"2019-10-22T15:29:28.000Z","updated_at":"2025-03-25T05:12:30.000Z","dependencies_parsed_at":"2023-10-12T23:15:14.224Z","dependency_job_id":"707a4055-f52d-40dd-a90f-b1bec34f484e","html_url":"https://github.com/taiki-e/pin-project-lite","commit_stats":{"total_commits":601,"total_committers":11,"mean_commits":54.63636363636363,"dds":0.08319467554076543,"last_synced_commit":"a3f1fb0a30c082561fef9dcdee4ba0288f51027b"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fpin-project-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fpin-project-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fpin-project-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fpin-project-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taiki-e","download_url":"https://codeload.github.com/taiki-e/pin-project-lite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248019799,"owners_count":21034315,"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","rust"],"created_at":"2024-08-04T08:02:01.865Z","updated_at":"2026-02-27T17:31:20.889Z","avatar_url":"https://github.com/taiki-e.png","language":"Rust","funding_links":["https://github.com/sponsors/taiki-e"],"categories":["Rust"],"sub_categories":[],"readme":"# pin-project-lite\n\n[![crates.io](https://img.shields.io/crates/v/pin-project-lite?style=flat-square\u0026logo=rust)](https://crates.io/crates/pin-project-lite)\n[![docs.rs](https://img.shields.io/badge/docs.rs-pin--project--lite-blue?style=flat-square\u0026logo=docs.rs)](https://docs.rs/pin-project-lite)\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.37-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-lite/ci.yml?branch=main\u0026style=flat-square\u0026logo=github)](https://github.com/taiki-e/pin-project-lite/actions)\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:start:src/lib.rs --\u003e\n\nA lightweight version of [pin-project] written with declarative macros.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\npin-project-lite = \"0.2\"\n```\n\n## Examples\n\n[`pin_project!`] macro creates a projection type covering all the fields of\nstruct.\n\n```rust\nuse std::pin::Pin;\n\nuse pin_project_lite::pin_project;\n\npin_project! {\n    struct Struct\u003cT, U\u003e {\n        #[pin]\n        pinned: T,\n        unpinned: U,\n    }\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\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_lite::pin_project;\n\npin_project! {\n    #[project = EnumProj]\n    enum Enum\u003cT, U\u003e {\n        Variant { #[pin] pinned: T, unpinned: U },\n    }\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::Variant { pinned, unpinned } =\u003e {\n                let _: Pin\u003c\u0026mut T\u003e = pinned;\n                let _: \u0026mut U = unpinned;\n            }\n        }\n    }\n}\n```\n\n## [pin-project] vs pin-project-lite\n\nHere are some similarities and differences compared to [pin-project].\n\n### Similar: Safety\n\npin-project-lite guarantees safety in much the same way as [pin-project].\nBoth are completely safe unless you write other unsafe code.\n\n### Different: Minimal design\n\nThis library does not tackle as expansive of a range of use cases as\n[pin-project] does. If your use case is not already covered, please use\n[pin-project].\n\n### Different: No proc-macro related dependencies\n\nThis is the **only** reason to use this crate. However, **if you already\nhave proc-macro related dependencies in your crate's dependency graph, there\nis no benefit from using this crate.** (Note: There is almost no difference\nin the amount of code generated between [pin-project] and pin-project-lite.)\n\n### Different: No useful error messages\n\nThis macro does not handle any invalid input. So error messages are not to\nbe useful in most cases. If you do need useful error messages, then upon\nerror you can pass the same input to [pin-project] to receive a helpful\ndescription of the compile error.\n\n### Different: No support for custom Unpin implementation\n\npin-project supports this by [`UnsafeUnpin`][unsafe-unpin]. (`!Unpin` is supported by both [pin-project][not-unpin] and [pin-project-lite][not-unpin-lite].)\n\n### Different: No support for tuple structs and tuple variants\n\npin-project supports this.\n\n[not-unpin]: https://docs.rs/pin-project/latest/pin_project/attr.pin_project.html#unpin\n[pin-project]: https://github.com/taiki-e/pin-project\n[unsafe-unpin]: https://docs.rs/pin-project/latest/pin_project/attr.pin_project.html#unsafeunpin\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:end --\u003e\n\n[not-unpin-lite]: https://docs.rs/pin-project-lite/latest/pin_project_lite/macro.pin_project.html#unpin\n[`pin_project!`]: https://docs.rs/pin-project-lite/latest/pin_project_lite/macro.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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fpin-project-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaiki-e%2Fpin-project-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fpin-project-lite/lists"}