compilation fix

This commit is contained in:
Mwa
2026-03-17 21:05:51 +01:00
parent 902ed046ca
commit 8fa56c5b6f
2 changed files with 8 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
use regex::Regex;
use std::env::args;
use std::{borrow::Cow, env::args};
fn main() {
let path = args().nth(1).expect("usage: 1 image file argument");
@@ -12,9 +12,9 @@ fn main() {
println!(" D 0x{d:08x}");
}
}
fn remove_non_alphanumeric(input: &str) -> String {
fn remove_non_alphanumeric(input: &str) -> Cow<'_, str> {
let re = Regex::new(r"[^a-zA-Z0-9_]+").unwrap();
re.replace_all(input, "").to_string()
re.replace_all(input, "")
}
fn path_to_img(path: &str) -> (Vec<u32>, String, u32, u32) {
@@ -48,6 +48,9 @@ fn path_to_img(path: &str) -> (Vec<u32>, String, u32, u32) {
}
let path = path.split('/').next_back().unwrap();
let split: Vec<_> = path.split('.').collect();
let name = remove_non_alphanumeric(&split[0..split.len() - 1].join("_")).to_lowercase();
let name = format!(
"picture_{}",
remove_non_alphanumeric(&split[0..split.len() - 1].join("_")).to_lowercase()
);
(bytes, name, width, height)
}

View File

@@ -21,9 +21,9 @@ use winit::application::ApplicationHandler;
use winit::dpi::LogicalSize;
use winit::event::WindowEvent;
use winit::event_loop::EventLoop;
use winit::platform::modifier_supplement::KeyEventExtModifierSupplement;
use winit::platform::scancode::PhysicalKeyExtScancode;
use winit::window::Window;
// use winit_input_helper::WinitInputHelper;
use crate::cpu::{Computer, MMIOInterupt};
mod wait;