material_design_icons_pack/
lib.rs

1#![doc = include_str!("../README.md")]
2mod icons;
3pub use icons::*;
4
5mod finder;
6pub use finder::get_icon;
7
8#[cfg(feature = "pyo3")]
9use pyo3::prelude::*;
10#[cfg(feature = "pyo3")]
11pub mod py_binding;
12
13/// A Generic structure to describe a single icon.
14#[cfg_attr(
15    feature = "pyo3",
16    pyclass(module = "material_design_icons_pack", get_all, frozen)
17)]
18#[derive(Debug, PartialEq, Eq)]
19pub struct Icon {
20    /// The SVG data.
21    pub svg: &'static str,
22
23    /// The slug to identify the icon.
24    pub slug: &'static str,
25
26    /// The version of the icon.
27    pub version: &'static str,
28
29    /// A flag to indicate deprecation of the icon.
30    pub deprecated: bool,
31
32    /// The author of the icon.
33    pub author: &'static str,
34    // The list of `styles` and `aliases` would need (in a const context) either
35    // - a lifetime boundary
36    // - "lazy" static allocation
37    // Both solutions do not work well for python bindings.
38}
39
40#[cfg(feature = "pyo3")]
41#[cfg_attr(feature = "pyo3", pymethods)]
42impl Icon {
43    pub fn __repr__(&self) -> PyResult<String> {
44        Ok(format!("< Icon object for slug {} >", self.slug))
45    }
46}