From d700234c3c84e80c38d558b205a81074fb45b845 Mon Sep 17 00:00:00 2001 From: chyyran Date: Sat, 3 Feb 2024 02:16:38 -0500 Subject: [PATCH] presets: polyfill extract_if --- Cargo.lock | 7 +++++++ librashader-presets/Cargo.toml | 1 + librashader-presets/src/lib.rs | 3 ++- librashader-presets/src/parse/preset.rs | 1 + librashader-presets/src/parse/value.rs | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 1dfbaf5..636fc72 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1258,6 +1258,7 @@ dependencies = [ "nom_locate", "num-traits", "thiserror", + "vec_extract_if_polyfill", ] [[package]] @@ -2348,6 +2349,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "vec_extract_if_polyfill" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c9cb5fb67c2692310b6eb3fce7dd4b6e4c9a75be4f2f46b27f0b2b7799759c" + [[package]] name = "vec_map" version = "0.8.2" diff --git a/librashader-presets/Cargo.toml b/librashader-presets/Cargo.toml index 88a610a..5fe2113 100644 --- a/librashader-presets/Cargo.toml +++ b/librashader-presets/Cargo.toml @@ -17,6 +17,7 @@ nom = "7.1.1" nom_locate = "4.0.0" librashader-common = { path = "../librashader-common", version = "0.2.0-beta.2" } num-traits = "0.2" +vec_extract_if_polyfill = "0.1" [features] parse_legacy_glsl = [] diff --git a/librashader-presets/src/lib.rs b/librashader-presets/src/lib.rs index a8b2d6a..f317a46 100644 --- a/librashader-presets/src/lib.rs +++ b/librashader-presets/src/lib.rs @@ -7,7 +7,8 @@ //! as input to create a filter chain. //! //! Re-exported as [`librashader::presets`](https://docs.rs/librashader/latest/librashader/presets/index.html). -#![feature(extract_if)] + +#![allow(unstable_name_collisions)] mod error; mod parse; diff --git a/librashader-presets/src/parse/preset.rs b/librashader-presets/src/parse/preset.rs index dbeab4b..b9f392c 100644 --- a/librashader-presets/src/parse/preset.rs +++ b/librashader-presets/src/parse/preset.rs @@ -1,6 +1,7 @@ use crate::parse::remove_if; use crate::parse::value::Value; use crate::{ParameterConfig, Scale2D, Scaling, ShaderPassConfig, ShaderPreset, TextureConfig}; +use vec_extract_if_polyfill::MakeExtractIf; pub fn resolve_values(mut values: Vec) -> ShaderPreset { let textures: Vec = values diff --git a/librashader-presets/src/parse/value.rs b/librashader-presets/src/parse/value.rs index 48325d2..6037d6b 100644 --- a/librashader-presets/src/parse/value.rs +++ b/librashader-presets/src/parse/value.rs @@ -16,6 +16,7 @@ use std::io::Read; use std::path::{Path, PathBuf}; use std::str::FromStr; +use vec_extract_if_polyfill::MakeExtractIf; #[derive(Debug)] pub enum Value { ShaderCount(i32),