File tree 3 files changed +32
-30
lines changed
3 files changed +32
-30
lines changed Original file line number Diff line number Diff line change @@ -111,36 +111,6 @@ mod shared;
111
111
#[ cfg( any( feature = "std" , all( feature = "alloc" , feature = "spin" ) ) ) ]
112
112
pub use self :: shared:: { Shared , WeakShared } ;
113
113
114
- /// Pins a value on the stack.
115
- ///
116
- /// **Note:** Since Rust 1.68, this macro is soft-deprecated in favor of
117
- /// [`pin!`](https://doc.rust-lang.org/std/pin/macro.pin.html) macro
118
- /// in the standard library.
119
- ///
120
- /// # Example
121
- ///
122
- /// ```rust
123
- /// # use futures_util::pin_mut;
124
- /// # use core::pin::Pin;
125
- /// # struct Foo {}
126
- /// let foo = Foo { /* ... */ };
127
- /// pin_mut!(foo);
128
- /// let _: Pin<&mut Foo> = foo;
129
- /// ```
130
- #[ macro_export]
131
- macro_rules! pin_mut {
132
- ( $( $x: ident) ,* $( , ) ?) => { $(
133
- // Move the value to ensure that it is owned
134
- let mut $x = $x;
135
- // Shadow the original binding so that it can't be directly accessed
136
- // ever again.
137
- #[ allow( unused_mut) ]
138
- let mut $x = unsafe {
139
- :: core:: pin:: Pin :: new_unchecked( & mut $x)
140
- } ;
141
- ) * }
142
- }
143
-
144
114
impl < T : ?Sized > FutureExt for T where T : Future { }
145
115
146
116
/// An extension trait for `Future`s that provides a variety of convenient
Original file line number Diff line number Diff line change @@ -328,3 +328,4 @@ mod abortable;
328
328
329
329
mod fns;
330
330
mod unfold_state;
331
+ mod macros;
Original file line number Diff line number Diff line change
1
+ /// Pins a value on the stack.
2
+ ///
3
+ /// Can safely pin values that are not `Unpin` by taking ownership.
4
+ ///
5
+ /// **Note:** Since Rust 1.68, this macro is soft-deprecated in favor of
6
+ /// [`pin!`](https://doc.rust-lang.org/std/pin/macro.pin.html) macro
7
+ /// in the standard library.
8
+ ///
9
+ /// # Example
10
+ ///
11
+ /// ```rust
12
+ /// # use futures_util::pin_mut;
13
+ /// # use core::pin::Pin;
14
+ /// # struct Foo {}
15
+ /// let foo = Foo { /* ... */ };
16
+ /// pin_mut!(foo);
17
+ /// let _: Pin<&mut Foo> = foo;
18
+ /// ```
19
+ #[ macro_export]
20
+ macro_rules! pin_mut {
21
+ ( $( $x: ident) ,* $( , ) ?) => { $(
22
+ // Move the value to ensure that it is owned
23
+ let mut $x = $x;
24
+ // Shadow the original binding so that it can't be directly accessed
25
+ // ever again.
26
+ #[ allow( unused_mut) ]
27
+ let mut $x = unsafe {
28
+ :: core:: pin:: Pin :: new_unchecked( & mut $x)
29
+ } ;
30
+ ) * }
31
+ }
You can’t perform that action at this time.
0 commit comments