1
0
Fork 0
forked from wry/wry

config: add comm client criteria

This commit is contained in:
Julian Orth 2025-05-03 13:03:48 +02:00
parent bdabb7bbdd
commit cc734a135c
12 changed files with 73 additions and 2 deletions

View file

@ -15,8 +15,10 @@ pub type ClmMatchString<T> = CritMatchString<Rc<Client>, T>;
pub type ClmMatchSandboxEngine = ClmMatchString<AcceptorMetadataAccess<SandboxEngineField>>;
pub type ClmMatchSandboxAppId = ClmMatchString<AcceptorMetadataAccess<SandboxAppIdField>>;
pub type ClmMatchSandboxInstanceId = ClmMatchString<AcceptorMetadataAccess<SandboxInstanceIdField>>;
pub type ClmMatchComm = ClmMatchString<CommAccess>;
pub struct AcceptorMetadataAccess<T>(PhantomData<T>);
pub struct CommAccess;
trait SandboxField: Sized + 'static {
fn field(meta: &AcceptorMetadata) -> &Option<String>;
@ -77,3 +79,13 @@ impl SandboxField for SandboxInstanceIdField {
&roots.sandbox_instance_id
}
}
impl StringAccess<Rc<Client>> for CommAccess {
fn with_string(data: &Rc<Client>, f: impl FnOnce(&str) -> bool) -> bool {
f(&data.pid_info.comm)
}
fn nodes(roots: &RootMatchers) -> &ClmRootMatcherMap<ClmMatchString<Self>> {
&roots.comm
}
}