doki_core/config/
path.rs

1use super::*;
2
3pub struct DokiPath {
4    version: String,
5    language: String,
6    path: Vec<String>,
7}
8
9impl DokiConfig {
10    pub fn build_url(&self, path: &DokiPath) -> String {
11        let mut out: String = self.url_base.join("/");
12        if let true = self.version_enable() {
13            out.write_char('/').ok();
14            out.write_str(&path.version).ok();
15        }
16        if let true = self.i18n_enable() {
17            out.write_char('/').ok();
18            out.write_str(&path.language).ok();
19        }
20        for p in &path.path {
21            out.write_char('/').ok();
22            out.write_str(&p).ok();
23        }
24        match &self.url_end {
25            None => {}
26            Some(s) => out.push_str(s),
27        }
28        return out;
29    }
30}