Integrate "SmartDefault" as "AutoDefault" macro

This commit is contained in:
Manuel Cillero 2024-02-27 21:57:16 +01:00
parent cb38145bf5
commit 9e4f593dbd
51 changed files with 387 additions and 103 deletions

View file

@ -1,11 +1,11 @@
use crate::core::action::ActionTrait;
use crate::SmartDefault;
use crate::AutoDefault;
use std::sync::{Arc, RwLock};
pub type Action = Box<dyn ActionTrait>;
#[derive(SmartDefault)]
#[derive(AutoDefault)]
pub struct ActionsList(Arc<RwLock<Vec<Action>>>);
impl ActionsList {

View file

@ -1,9 +1,9 @@
use crate::core::component::Context;
use crate::SmartDefault;
use crate::AutoDefault;
pub type FnIsRenderable = fn(cx: &Context) -> bool;
#[derive(SmartDefault)]
#[derive(AutoDefault)]
pub struct Renderable {
#[default(_code = "render_always")]
pub check: FnIsRenderable,

View file

@ -1,6 +1,6 @@
use crate::core::component::{AnyComponents, ArcAnyComponent, ArcAnyOp};
use crate::core::theme::ThemeRef;
use crate::{LazyStatic, SmartDefault, TypeId};
use crate::{AutoDefault, LazyStatic, TypeId};
use std::collections::HashMap;
use std::sync::RwLock;
@ -11,7 +11,7 @@ static THEME_REGIONS: LazyStatic<RwLock<HashMap<TypeId, ComponentsInRegions>>> =
static COMMON_REGIONS: LazyStatic<RwLock<ComponentsInRegions>> =
LazyStatic::new(|| RwLock::new(ComponentsInRegions::default()));
#[derive(SmartDefault)]
#[derive(AutoDefault)]
pub struct ComponentsInRegions(HashMap<&'static str, AnyComponents>);
impl ComponentsInRegions {