@@ -25,22 +25,6 @@ pub struct PinnedGenerator<I, A, R> {
25
25
}
26
26
27
27
impl < I , A , R > PinnedGenerator < I , A , R > {
28
- #[ cfg( bootstrap) ]
29
- pub fn new < T : Generator < Yield = YieldType < I , A > , Return = R > + ' static > (
30
- generator : T ,
31
- ) -> ( I , Self ) {
32
- let mut result = PinnedGenerator { generator : Box :: pin ( generator) } ;
33
-
34
- // Run it to the first yield to set it up
35
- let init = match Pin :: new ( & mut result. generator ) . resume ( ) {
36
- GeneratorState :: Yielded ( YieldType :: Initial ( y) ) => y,
37
- _ => panic ! ( ) ,
38
- } ;
39
-
40
- ( init, result)
41
- }
42
-
43
- #[ cfg( not( bootstrap) ) ]
44
28
pub fn new < T : Generator < Yield = YieldType < I , A > , Return = R > + ' static > (
45
29
generator : T ,
46
30
) -> ( I , Self ) {
@@ -55,19 +39,6 @@ impl<I, A, R> PinnedGenerator<I, A, R> {
55
39
( init, result)
56
40
}
57
41
58
- #[ cfg( bootstrap) ]
59
- pub unsafe fn access ( & mut self , closure : * mut dyn FnMut ( ) ) {
60
- BOX_REGION_ARG . with ( |i| {
61
- i. set ( Action :: Access ( AccessAction ( closure) ) ) ;
62
- } ) ;
63
-
64
- // Call the generator, which in turn will call the closure in BOX_REGION_ARG
65
- if let GeneratorState :: Complete ( _) = Pin :: new ( & mut self . generator ) . resume ( ) {
66
- panic ! ( )
67
- }
68
- }
69
-
70
- #[ cfg( not( bootstrap) ) ]
71
42
pub unsafe fn access ( & mut self , closure : * mut dyn FnMut ( ) ) {
72
43
BOX_REGION_ARG . with ( |i| {
73
44
i. set ( Action :: Access ( AccessAction ( closure) ) ) ;
@@ -79,16 +50,6 @@ impl<I, A, R> PinnedGenerator<I, A, R> {
79
50
}
80
51
}
81
52
82
- #[ cfg( bootstrap) ]
83
- pub fn complete ( & mut self ) -> R {
84
- // Tell the generator we want it to complete, consuming it and yielding a result
85
- BOX_REGION_ARG . with ( |i| i. set ( Action :: Complete ) ) ;
86
-
87
- let result = Pin :: new ( & mut self . generator ) . resume ( ) ;
88
- if let GeneratorState :: Complete ( r) = result { r } else { panic ! ( ) }
89
- }
90
-
91
- #[ cfg( not( bootstrap) ) ]
92
53
pub fn complete ( & mut self ) -> R {
93
54
// Tell the generator we want it to complete, consuming it and yielding a result
94
55
BOX_REGION_ARG . with ( |i| i. set ( Action :: Complete ) ) ;
0 commit comments