From c191a897222cc397a8590b94bf86172ada03d3dc Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 10 Jun 2024 10:11:39 +0000 Subject: refactor: bump nightly again I forgot that it's 2024. It looks like generators were renamed to coroutines. --- src/main.rs | 2 +- src/ppm.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 60fcfbd..e7595f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ // Copyright (C) 2022-2022 Fuwn // SPDX-License-Identifier: MIT -#![feature(decl_macro, generators, generator_trait, lazy_cell)] +#![feature(decl_macro, coroutines, coroutine_trait)] #![deny( warnings, nonstandard_style, diff --git a/src/ppm.rs b/src/ppm.rs index 7e51a75..b829b64 100644 --- a/src/ppm.rs +++ b/src/ppm.rs @@ -10,7 +10,7 @@ use { collections::HashMap, fs, io::{Cursor, Read}, - ops::Generator, + ops::Coroutine, sync::OnceLock, }, }; @@ -324,7 +324,8 @@ impl PPMParser { fn read_line_types( line_types: &[u8], - ) -> impl Generator + '_ { + ) -> impl Coroutine + '_ { + #[coroutine] move || { for index in 0..192 { let line_type = @@ -374,7 +375,7 @@ impl PPMParser { { let mut generator = Self::read_line_types(&line_types[layer]); - while let std::ops::GeneratorState::Yielded((line, line_type)) = + while let std::ops::CoroutineState::Yielded((line, line_type)) = std::pin::Pin::new(&mut generator).resume(()) { let mut pixel = 0; -- cgit v1.2.3