Replace Pin::new with .as_mut()
This commit is contained in:
parent
bddf151dea
commit
ecc68e7879
1 changed files with 5 additions and 3 deletions
|
@ -140,7 +140,7 @@ impl BoxedResolver {
|
||||||
let mut generator = Box::pin(generator);
|
let mut generator = Box::pin(generator);
|
||||||
|
|
||||||
// Run it to the first yield to set it up
|
// Run it to the first yield to set it up
|
||||||
let init = match Pin::new(&mut generator).resume(Action::Initial) {
|
let init = match generator.as_mut().resume(Action::Initial) {
|
||||||
GeneratorState::Yielded(YieldType::Initial(y)) => y,
|
GeneratorState::Yielded(YieldType::Initial(y)) => y,
|
||||||
_ => panic!(),
|
_ => panic!(),
|
||||||
};
|
};
|
||||||
|
@ -162,7 +162,9 @@ impl BoxedResolver {
|
||||||
// Get the generator to call our closure
|
// Get the generator to call our closure
|
||||||
unsafe {
|
unsafe {
|
||||||
// Call the generator, which in turn will call the closure
|
// Call the generator, which in turn will call the closure
|
||||||
if let GeneratorState::Complete(_) = Pin::new(&mut self.generator)
|
if let GeneratorState::Complete(_) = self
|
||||||
|
.generator
|
||||||
|
.as_mut()
|
||||||
.resume(Action::Access(AccessAction(::std::mem::transmute(mut_f))))
|
.resume(Action::Access(AccessAction(::std::mem::transmute(mut_f))))
|
||||||
{
|
{
|
||||||
panic!()
|
panic!()
|
||||||
|
@ -175,7 +177,7 @@ impl BoxedResolver {
|
||||||
|
|
||||||
pub fn complete(mut self) -> ResolverOutputs {
|
pub fn complete(mut self) -> ResolverOutputs {
|
||||||
// Tell the generator we want it to complete, consuming it and yielding a result
|
// Tell the generator we want it to complete, consuming it and yielding a result
|
||||||
let result = Pin::new(&mut self.generator).resume(Action::Complete);
|
let result = self.generator.as_mut().resume(Action::Complete);
|
||||||
if let GeneratorState::Complete(r) = result { r } else { panic!() }
|
if let GeneratorState::Complete(r) = result { r } else { panic!() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue