pdk-unit 1.8.0

PDK Unit Test Framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright (c) 2026, Salesforce, Inc.,
// All rights reserved.
// For full license text, see the LICENSE.txt file
use crate::UnitHttpResponse;
use regex::Regex;
use std::thread::LocalKey;

pub fn matches<'a, const N: usize>(
    key: &'static LocalKey<Regex>,
    other: &'a str,
) -> Option<[&'a str; N]> {
    key.with(|re| re.captures(other).map(|c| c.extract().1))
}

pub fn not_found() -> UnitHttpResponse {
    UnitHttpResponse::new(404)
}