feat: Reuse compiled regex
Committed / committed (pull_request) Successful in 26s
CI / cargo shear (pull_request) Successful in 5m12s
CI / prek (pull_request) Failing after 6m43s

This commit is contained in:
2026-10-20 03:11:27 +02:00
parent 8149ffbc37
commit 427ec6f61d
+2 -4
View File
@@ -2,16 +2,14 @@ use crete::cluster::Cluster;
use crete::environment::configure_environment;
use ipxe::IPXE_DIR;
use minijinja::{Environment, context};
use regex::Regex;
use regex::regex;
// TODO: Make this a proper async function
pub fn get_file(
filename: impl ToString,
http_url: impl ToString,
) -> impl Future<Output = Option<(Vec<u8>, &'static str)>> {
// TODO: Make this a static that is initialized once
let re =
Regex::new(r"^talos/(?<cluster>.+)/(?<node>.+)\.ya?ml$").expect("regex should be valid");
let re = regex!(r"^talos/(?<cluster>.+)/(?<node>.+)\.ya?ml$");
let filename: String = filename.to_string();
let re = re.clone();