presets: polyfill extract_if

This commit is contained in:
chyyran 2024-02-03 02:16:38 -05:00 committed by Ronny Chan
parent 96f937586c
commit d700234c3c
5 changed files with 12 additions and 1 deletions

7
Cargo.lock generated
View file

@ -1258,6 +1258,7 @@ dependencies = [
"nom_locate", "nom_locate",
"num-traits", "num-traits",
"thiserror", "thiserror",
"vec_extract_if_polyfill",
] ]
[[package]] [[package]]
@ -2348,6 +2349,12 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 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]] [[package]]
name = "vec_map" name = "vec_map"
version = "0.8.2" version = "0.8.2"

View file

@ -17,6 +17,7 @@ nom = "7.1.1"
nom_locate = "4.0.0" nom_locate = "4.0.0"
librashader-common = { path = "../librashader-common", version = "0.2.0-beta.2" } librashader-common = { path = "../librashader-common", version = "0.2.0-beta.2" }
num-traits = "0.2" num-traits = "0.2"
vec_extract_if_polyfill = "0.1"
[features] [features]
parse_legacy_glsl = [] parse_legacy_glsl = []

View file

@ -7,7 +7,8 @@
//! as input to create a filter chain. //! as input to create a filter chain.
//! //!
//! Re-exported as [`librashader::presets`](https://docs.rs/librashader/latest/librashader/presets/index.html). //! Re-exported as [`librashader::presets`](https://docs.rs/librashader/latest/librashader/presets/index.html).
#![feature(extract_if)]
#![allow(unstable_name_collisions)]
mod error; mod error;
mod parse; mod parse;

View file

@ -1,6 +1,7 @@
use crate::parse::remove_if; use crate::parse::remove_if;
use crate::parse::value::Value; use crate::parse::value::Value;
use crate::{ParameterConfig, Scale2D, Scaling, ShaderPassConfig, ShaderPreset, TextureConfig}; use crate::{ParameterConfig, Scale2D, Scaling, ShaderPassConfig, ShaderPreset, TextureConfig};
use vec_extract_if_polyfill::MakeExtractIf;
pub fn resolve_values(mut values: Vec<Value>) -> ShaderPreset { pub fn resolve_values(mut values: Vec<Value>) -> ShaderPreset {
let textures: Vec<TextureConfig> = values let textures: Vec<TextureConfig> = values

View file

@ -16,6 +16,7 @@ use std::io::Read;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
use vec_extract_if_polyfill::MakeExtractIf;
#[derive(Debug)] #[derive(Debug)]
pub enum Value { pub enum Value {
ShaderCount(i32), ShaderCount(i32),