Commit bb0be551 authored by Jonas Platte's avatar Jonas Platte

Update to work on latest nightly

parent f3c2723d
......@@ -33,28 +33,28 @@
//! ```
//!
#![feature(generators, generator_trait)]
// #![feature(conservative_impl_trait)]
#![feature(generators, generator_trait, pin)]
use std::ops::{Generator, GeneratorState};
use std::iter::Iterator;
use std::marker::Unpin;
/// a iterator that holds an internal generator representing
/// the iteration state
#[derive(Copy, Clone, Debug)]
pub struct GenIter<T>(pub T)
where
T: Generator<Return = ()>;
T: Generator<Return = ()> + Unpin;
impl<T> Iterator for GenIter<T>
where
T: Generator<Return = ()>,
T: Generator<Return = ()> + Unpin,
{
type Item = T::Yield;
#[inline]
fn next(&mut self) -> Option<Self::Item> {
match self.0.resume() {
match unsafe { self.0.resume() } {
GeneratorState::Yielded(n) => Some(n),
GeneratorState::Complete(()) => None,
}
......@@ -63,7 +63,7 @@ where
impl<G> From<G> for GenIter<G>
where
G: Generator<Return = ()>,
G: Generator<Return = ()> + Unpin,
{
#[inline]
fn from(gen: G) -> Self {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment