Skip to main content

rdf_compare/web/
assets.rs

1//! Embedded static assets for the web viewer.
2
3pub struct Asset {
4    pub path: &'static str,
5    pub mime: &'static str,
6    pub bytes: &'static [u8],
7}
8
9macro_rules! txt {
10    ($p:literal, $mime:literal, $file:literal) => {
11        Asset {
12            path: $p,
13            mime: $mime,
14            bytes: include_bytes!(concat!("../../", $file)),
15        }
16    };
17}
18
19pub static ASSETS: &[Asset] = &[
20    txt!(
21        "/assets/app/index.html",
22        "text/html; charset=utf-8",
23        "assets/app/index.html"
24    ),
25    txt!(
26        "/assets/app/app.js",
27        "application/javascript",
28        "assets/app/app.js"
29    ),
30    txt!(
31        "/assets/app/map.js",
32        "application/javascript",
33        "assets/app/map.js"
34    ),
35    txt!(
36        "/assets/app/styles.css",
37        "text/css; charset=utf-8",
38        "assets/app/styles.css"
39    ),
40    txt!(
41        "/assets/vendor/tabulator/tabulator.min.js",
42        "application/javascript",
43        "assets/vendor/tabulator/tabulator.min.js"
44    ),
45    txt!(
46        "/assets/vendor/tabulator/tabulator.min.css",
47        "text/css; charset=utf-8",
48        "assets/vendor/tabulator/tabulator.min.css"
49    ),
50    txt!(
51        "/assets/vendor/leaflet/leaflet.js",
52        "application/javascript",
53        "assets/vendor/leaflet/leaflet.js"
54    ),
55    txt!(
56        "/assets/vendor/leaflet/leaflet.css",
57        "text/css; charset=utf-8",
58        "assets/vendor/leaflet/leaflet.css"
59    ),
60    txt!(
61        "/assets/vendor/leaflet/images/marker-icon.png",
62        "image/png",
63        "assets/vendor/leaflet/images/marker-icon.png"
64    ),
65    txt!(
66        "/assets/vendor/leaflet/images/marker-icon-2x.png",
67        "image/png",
68        "assets/vendor/leaflet/images/marker-icon-2x.png"
69    ),
70    txt!(
71        "/assets/vendor/leaflet/images/marker-shadow.png",
72        "image/png",
73        "assets/vendor/leaflet/images/marker-shadow.png"
74    ),
75    txt!(
76        "/assets/vendor/leaflet/images/layers.png",
77        "image/png",
78        "assets/vendor/leaflet/images/layers.png"
79    ),
80    txt!(
81        "/assets/vendor/leaflet/images/layers-2x.png",
82        "image/png",
83        "assets/vendor/leaflet/images/layers-2x.png"
84    ),
85    txt!(
86        "/assets/vendor/wellknown/wellknown.js",
87        "application/javascript",
88        "assets/vendor/wellknown/wellknown.js"
89    ),
90];
91
92pub fn lookup(path: &str) -> Option<&'static Asset> {
93    ASSETS.iter().find(|a| a.path == path)
94}