summaryrefslogtreecommitdiffstats
path: root/icons/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'icons/src/lib.rs')
-rw-r--r--icons/src/lib.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/icons/src/lib.rs b/icons/src/lib.rs
new file mode 100644
index 0000000..355e674
--- /dev/null
+++ b/icons/src/lib.rs
@@ -0,0 +1,49 @@
+pub struct Icon {
+ pub path: &'static str,
+ pub content: &'static str,
+}
+
+macro_rules! icons_consts {
+ ($i:ident => $p:expr) => {
+ pub const $i: Icon = Icon {
+ path: $p,
+ content: include_str!(concat!("../res/", $p)),
+ };
+ };
+ ($i1:ident => $p1:expr, $($i2:ident => $p2:expr),+) => {
+ icons_consts! { $i1 => $p1 }
+ icons_consts! { $($i2 => $p2),+ }
+ }
+}
+
+macro_rules! icons_map {
+ ($($i:ident => $p:expr),+) => {
+ pub const ICONS_MAP: phf::Map<&'static str, &'static Icon> = phf::phf_map! {
+ $($p => &icons::$i),+
+ };
+ }
+}
+
+macro_rules! icons {
+ ($($i:ident => $p:expr),+) => {
+ pub mod icons {
+ use super::Icon;
+
+ icons_consts! {
+ $($i => $p),+
+ }
+ }
+
+ icons_map! {
+ $($i => $p),+
+ }
+ }
+}
+
+icons! {
+ NOTIFICATIONS => "notifications.svg",
+ NOTIFICATIONS_SOME => "notifications-some.svg",
+ PERSON => "person.svg"
+}
+
+pub use icons::*;