aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-06-10 10:11:39 +0000
committerFuwn <[email protected]>2024-06-10 10:12:18 +0000
commitc191a897222cc397a8590b94bf86172ada03d3dc (patch)
tree0a4c7a49b9ce4302a8b4d0265e75399f496fc1e6
parentstyle: use updated rustfmt rules (diff)
downloadpara-c191a897222cc397a8590b94bf86172ada03d3dc.tar.xz
para-c191a897222cc397a8590b94bf86172ada03d3dc.zip
refactor: bump nightly again
I forgot that it's 2024. It looks like generators were renamed to coroutines.
-rw-r--r--rust-toolchain.toml2
-rw-r--r--src/main.rs2
-rw-r--r--src/ppm.rs7
3 files changed, 6 insertions, 5 deletions
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index 1aa9c83..394ad0c 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,2 +1,2 @@
[toolchain]
-channel = "nightly-2023-06-10"
+channel = "nightly-2024-06-10"
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 <[email protected]>
// 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<Yield = (usize, u8), Return = ()> + '_ {
+ ) -> impl Coroutine<Yield = (usize, u8), Return = ()> + '_ {
+ #[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;