lensbench_core/coating/
remote.rs1use std::path::{Path, PathBuf};
4
5pub type RemoteLoader = fn(&Path, &str) -> Option<PathBuf>;
7
8#[derive(Clone, Copy, Default)]
10pub struct RemoteCoatings(pub Option<RemoteLoader>);
11
12pub fn set_remote_loader(f: RemoteLoader) {
15 crate::ext::update_default(|e| e.slot_mut::<RemoteCoatings>().0 = Some(f));
16}
17
18pub(in crate::coating) fn remote_loader() -> Option<RemoteLoader> {
19 crate::ext::current()
20 .slot::<RemoteCoatings>()
21 .and_then(|r| r.0)
22}
23
24pub type RemoteLister = fn(&Path) -> Vec<String>;
26
27#[derive(Clone, Copy, Default)]
29pub struct RemoteCoatingNames(pub Option<RemoteLister>);
30
31pub fn set_remote_lister(f: RemoteLister) {
34 crate::ext::update_default(|e| e.slot_mut::<RemoteCoatingNames>().0 = Some(f));
35}
36
37pub(in crate::coating) fn remote_lister() -> Option<RemoteLister> {
38 crate::ext::current()
39 .slot::<RemoteCoatingNames>()
40 .and_then(|r| r.0)
41}