1
0
Fork 0
forked from wry/wry

config: add title window criteria

This commit is contained in:
Julian Orth 2025-05-01 18:22:33 +02:00
parent 2b5be7fbd9
commit 6ef7655dbd
14 changed files with 109 additions and 23 deletions

View file

@ -20,3 +20,4 @@ macro_rules! fixed_root_criterion {
pub mod tlmm_client;
pub mod tlmm_kind;
pub mod tlmm_string;

View file

@ -0,0 +1,23 @@
use crate::{
criteria::{
crit_matchers::critm_string::{CritMatchString, StringAccess},
tlm::{RootMatchers, TlmRootMatcherMap},
},
tree::ToplevelData,
};
pub type TlmMatchString<T> = CritMatchString<ToplevelData, T>;
pub type TlmMatchTitle = TlmMatchString<TitleAccess>;
pub struct TitleAccess;
impl StringAccess<ToplevelData> for TitleAccess {
fn with_string(data: &ToplevelData, f: impl FnOnce(&str) -> bool) -> bool {
f(&data.title.borrow())
}
fn nodes(roots: &RootMatchers) -> &TlmRootMatcherMap<TlmMatchString<Self>> {
&roots.title
}
}