1use std::path::PathBuf;
2use semver::Version;
3pub use toml;
4
5pub trait FpmHost: Sync {
6 fn global_cache_dir(&self) -> PathBuf;
7 fn cache_dir_for(&self, id: &str) -> PathBuf;
8 fn font_install_dir(&self) -> PathBuf;
9 fn config(&self, id: String) -> Option<&toml::Value>;
10 fn version(&self) -> Version;
11 fn user_agent(&self) -> String;
12}
13
14#[derive(Copy, Clone)]
15pub struct EmptyFpmHost;
16impl EmptyFpmHost {
17 pub const EMPTY_HOST: EmptyFpmHost = EmptyFpmHost::new();
18 pub const fn new() -> Self {
19 return EmptyFpmHost {};
20 }
21}
22
23impl FpmHost for EmptyFpmHost {
24 fn global_cache_dir(&self) -> PathBuf {
25 unimplemented!()
26 }
27
28 fn cache_dir_for(&self, _: &str) -> PathBuf {
29 unimplemented!()
30 }
31
32 fn font_install_dir(&self) -> PathBuf {
33 unimplemented!()
34 }
35
36 fn config(&self, _: String) -> Option<&toml::Value> {
37 unimplemented!()
38 }
39
40 fn version(&self) -> Version {
41 unimplemented!()
42 }
43 fn user_agent(&self) -> String {
44 format!("FontPM-Host/{}", self.version())
45 }
46}