🚧 Apply last component management changes

This commit is contained in:
Manuel Cillero 2023-08-13 10:57:20 +02:00
parent 063ae2aae8
commit 350c750e16

View file

@ -23,7 +23,7 @@ pub struct Container {
classes : Classes, classes : Classes,
inner_classes : Classes, inner_classes : Classes,
container_type: ContainerType, container_type: ContainerType,
content : PackComponents, stuff : PackComponents,
template : String, template : String,
} }
@ -131,7 +131,7 @@ impl Container {
} }
#[fn_builder] #[fn_builder]
pub fn alter_renderable(&mut self, check: IsRenderable) -> &mut Self { pub fn alter_renderable(&mut self, check: FnIsRenderable) -> &mut Self {
self.renderable.check = check; self.renderable.check = check;
self self
} }
@ -155,12 +155,17 @@ impl Container {
} }
pub fn with_component(mut self, component: impl ComponentTrait) -> Self { pub fn with_component(mut self, component: impl ComponentTrait) -> Self {
self.content.alter(PackOp::Add, ComponentRef::to(component)); self.stuff.alter(PackOp::Add, ComponentArc::new(component));
self
}
pub fn with_component_arc(mut self, arc: ComponentArc) -> Self {
self.stuff.alter(PackOp::Add, arc);
self self
} }
pub fn alter_components(&mut self, op: PackOp, component: impl ComponentTrait) -> &mut Self { pub fn alter_components(&mut self, op: PackOp, component: impl ComponentTrait) -> &mut Self {
self.content.alter(op, ComponentRef::to(component)); self.stuff.alter(op, ComponentArc::new(component));
self self
} }
@ -185,7 +190,7 @@ impl Container {
} }
pub fn components(&self) -> &PackComponents { pub fn components(&self) -> &PackComponents {
&self.content &self.stuff
} }
pub fn template(&self) -> &str { pub fn template(&self) -> &str {