@@ -25,22 +25,6 @@ pub struct PinnedGenerator<I, A, R> {
2525}
2626
2727impl < 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) ) ]
4428 pub fn new < T : Generator < Yield = YieldType < I , A > , Return = R > + ' static > (
4529 generator : T ,
4630 ) -> ( I , Self ) {
@@ -55,19 +39,6 @@ impl<I, A, R> PinnedGenerator<I, A, R> {
5539 ( init, result)
5640 }
5741
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) ) ]
7142 pub unsafe fn access ( & mut self , closure : * mut dyn FnMut ( ) ) {
7243 BOX_REGION_ARG . with ( |i| {
7344 i. set ( Action :: Access ( AccessAction ( closure) ) ) ;
@@ -79,16 +50,6 @@ impl<I, A, R> PinnedGenerator<I, A, R> {
7950 }
8051 }
8152
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) ) ]
9253 pub fn complete ( & mut self ) -> R {
9354 // Tell the generator we want it to complete, consuming it and yielding a result
9455 BOX_REGION_ARG . with ( |i| i. set ( Action :: Complete ) ) ;
0 commit comments