Actualiza y simplifica la estructura del código
Revisión general del código fuente para asegurar los elementos que deben ser públicos y estandarizar el uso de funciones globales.
This commit is contained in:
parent
67952f6840
commit
b6dd473578
34 changed files with 250 additions and 237 deletions
|
|
@ -1,4 +1,18 @@
|
|||
use crate::core::global;
|
||||
|
||||
pub use maud::{DOCTYPE, Markup, PreEscaped, html};
|
||||
|
||||
mod api;
|
||||
pub use api::{Theme, find_theme, register_theme};
|
||||
mod definition;
|
||||
pub use definition::Theme;
|
||||
|
||||
pub fn register_theme(t: &'static (dyn Theme + 'static)) {
|
||||
global::THEMES.write().unwrap().push(t);
|
||||
}
|
||||
|
||||
pub fn find_theme(name: &str) -> Option<&'static (dyn Theme + 'static)> {
|
||||
let themes = global::THEMES.write().unwrap();
|
||||
match themes.iter().find(|t| t.name() == name) {
|
||||
Some(theme) => Some(*theme),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue