@@ -26,7 +26,7 @@ mod project;
26
26
27
27
use proc_macro:: TokenStream ;
28
28
29
- use utils:: { Immutable , Mutable } ;
29
+ use utils:: { Immutable , Mutable , Owned } ;
30
30
31
31
/// An attribute that creates a projection struct covering all the fields.
32
32
///
@@ -520,7 +520,7 @@ pub fn project(args: TokenStream, input: TokenStream) -> TokenStream {
520
520
/// `project_ref` method.
521
521
///
522
522
/// This is the same as [`project`] attribute except it refers to the projected
523
- /// type returned by `project_ref` method.
523
+ /// type returned by the `project_ref` method.
524
524
///
525
525
/// See [`project`] attribute for more details.
526
526
///
@@ -531,6 +531,21 @@ pub fn project_ref(args: TokenStream, input: TokenStream) -> TokenStream {
531
531
project:: attribute ( & args. into ( ) , input, Immutable ) . into ( )
532
532
}
533
533
534
+ /// An attribute to provide way to refer to the projected type returned by
535
+ /// `project_replace` method.
536
+ ///
537
+ /// This is the same as [`project`] attribute except it refers to the projected
538
+ /// type returned by the `project_replace` method.
539
+ ///
540
+ /// See [`project`] attribute for more details.
541
+ ///
542
+ /// [`project`]: ./attr.project.html
543
+ #[ proc_macro_attribute]
544
+ pub fn project_replace ( args : TokenStream , input : TokenStream ) -> TokenStream {
545
+ let input = syn:: parse_macro_input!( input) ;
546
+ project:: attribute ( & args. into ( ) , input, Owned ) . into ( )
547
+ }
548
+
534
549
/// An internal helper macro.
535
550
#[ doc( hidden) ]
536
551
#[ proc_macro_derive( __PinProjectInternalDerive, attributes( pin) ) ]
0 commit comments