@@ -10,11 +10,6 @@ use core::pin::Pin;
10
10
use futures_core:: ready;
11
11
use futures_core:: task:: { Context , Poll } ;
12
12
13
- /// Create a new instance of `MaybeDone`.
14
- pub fn maybe_done < Fut : Future > ( future : Fut ) -> MaybeDone < Fut > {
15
- MaybeDone :: Future ( future)
16
- }
17
-
18
13
/// A future that may have completed.
19
14
#[ derive( Debug ) ]
20
15
pub enum MaybeDone < Fut : Future > {
@@ -28,10 +23,16 @@ pub enum MaybeDone<Fut: Future> {
28
23
}
29
24
30
25
impl < Fut : Future > MaybeDone < Fut > {
26
+ /// Create a new instance of `MaybeDone`.
27
+ pub fn new ( future : Fut ) -> MaybeDone < Fut > {
28
+ Self :: Future ( future)
29
+ }
30
+
31
31
/// Returns an [`Option`] containing a mutable reference to the output of the future.
32
32
/// The output of this method will be [`Some`] if and only if the inner
33
33
/// future has been completed and [`take`](MaybeDone::take)
34
34
/// has not yet been called.
35
+ #[ allow( clippy:: wrong_self_convention) ]
35
36
#[ inline]
36
37
pub fn as_mut ( self : Pin < & mut Self > ) -> Option < & mut Fut :: Output > {
37
38
unsafe {
@@ -47,6 +48,7 @@ impl<Fut: Future> MaybeDone<Fut> {
47
48
/// The output of this method will be [`Some`] if and only if the inner
48
49
/// future has been completed and [`take`](MaybeDone::take)
49
50
/// has not yet been called.
51
+ #[ allow( clippy:: wrong_self_convention) ]
50
52
#[ inline]
51
53
pub fn as_ref ( self : Pin < & Self > ) -> Option < & Fut :: Output > {
52
54
let this = self . get_ref ( ) ;
0 commit comments