-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
202: Allow naming the projected types r=taiki-e a=taiki-e By passing an argument with the same name as the method to the attribute, you can name the projection type returned from the method: ```rust #[pin_project( Replace, project = StructProj, project_ref = StructProjRef, project_replace = StructProjOwn, )] struct Struct<T> { #[pin] field: T, } let mut x = Struct { field: 0 }; let StructProj { field } = Pin::new(&mut x).project(); let StructProjRef { field } = Pin::new(&x).project_ref(); let StructProjOwn { field } = Pin::new(&mut x).project_replace(Struct { field: 1 }); ``` cc #43 Closes #124 TODO: * [x] add tests * [x] write docs * [x] separate unrelated changes; done in #214 * [x] msrv (`unrestricted_attribute_tokens` requires 1.34); done in #219 Co-authored-by: Taiki Endo <[email protected]>
- Loading branch information
Showing
17 changed files
with
744 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.