♻️ Rename smart pointers components for clarity

This commit is contained in:
Manuel Cillero 2024-03-04 22:21:40 +01:00
parent 9a5618ef4b
commit d80a594cf5
18 changed files with 151 additions and 155 deletions

View file

@ -1,8 +1,8 @@
use crate::core::component::{ArcTypedComponent, ComponentTrait, Context};
use crate::core::component::{ComponentTrait, Context, TypedComponent};
use crate::fn_builder;
use crate::html::{html, Markup};
pub struct OptionComponent<C: ComponentTrait>(Option<ArcTypedComponent<C>>);
pub struct OptionComponent<C: ComponentTrait>(Option<TypedComponent<C>>);
impl<C: ComponentTrait> Default for OptionComponent<C> {
fn default() -> Self {
@ -20,7 +20,7 @@ impl<C: ComponentTrait> OptionComponent<C> {
#[fn_builder]
pub fn alter_value(&mut self, component: Option<C>) -> &mut Self {
if let Some(component) = component {
self.0 = Some(ArcTypedComponent::new(component));
self.0 = Some(TypedComponent::with(component));
} else {
self.0 = None;
}
@ -29,7 +29,7 @@ impl<C: ComponentTrait> OptionComponent<C> {
// OptionComponent GETTERS.
pub fn get(&self) -> Option<ArcTypedComponent<C>> {
pub fn get(&self) -> Option<TypedComponent<C>> {
if let Some(value) = &self.0 {
return Some(value.clone());
}