🚧 Working on actions system
This commit is contained in:
parent
2ea0a1698e
commit
e732244a2e
15 changed files with 165 additions and 153 deletions
|
|
@ -52,67 +52,53 @@ impl ThemeTrait for Bootsier {
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
fn before_prepare_component(&self, component: &mut dyn ComponentTrait, _cx: &mut Context) {
|
fn before_prepare_component(&self, component: &mut dyn ComponentTrait, _cx: &mut Context) {
|
||||||
match component.type_id() {
|
if let Some(i) = component.downcast_mut::<Icon>() {
|
||||||
t if t == TypeId::of::<Icon>() => {
|
i.alter_classes(
|
||||||
if let Some(i) = component_as_mut::<Icon>(component) {
|
ClassesOp::Replace(i.font_size().to_string()),
|
||||||
i.alter_classes(
|
with_font(i.font_size()),
|
||||||
ClassesOp::Replace(i.font_size().to_string()),
|
);
|
||||||
with_font(i.font_size()),
|
} else if let Some(b) = component.downcast_mut::<Button>() {
|
||||||
);
|
b.alter_classes(ClassesOp::Replace("button__tap".to_owned()), "btn");
|
||||||
}
|
b.alter_classes(
|
||||||
}
|
ClassesOp::Replace(b.style().to_string()),
|
||||||
t if t == TypeId::of::<Button>() => {
|
match b.style() {
|
||||||
if let Some(b) = component_as_mut::<Button>(component) {
|
StyleBase::Default => "btn-primary",
|
||||||
b.alter_classes(ClassesOp::Replace("button__tap".to_owned()), "btn");
|
StyleBase::Info => "btn-info",
|
||||||
b.alter_classes(
|
StyleBase::Success => "btn-success",
|
||||||
ClassesOp::Replace(b.style().to_string()),
|
StyleBase::Warning => "btn-warning",
|
||||||
match b.style() {
|
StyleBase::Danger => "btn-danger",
|
||||||
StyleBase::Default => "btn-primary",
|
StyleBase::Light => "btn-light",
|
||||||
StyleBase::Info => "btn-info",
|
StyleBase::Dark => "btn-dark",
|
||||||
StyleBase::Success => "btn-success",
|
StyleBase::Link => "btn-link",
|
||||||
StyleBase::Warning => "btn-warning",
|
},
|
||||||
StyleBase::Danger => "btn-danger",
|
);
|
||||||
StyleBase::Light => "btn-light",
|
b.alter_classes(
|
||||||
StyleBase::Dark => "btn-dark",
|
ClassesOp::Replace(b.font_size().to_string()),
|
||||||
StyleBase::Link => "btn-link",
|
with_font(b.font_size()),
|
||||||
},
|
);
|
||||||
);
|
} else if let Some(h) = component.downcast_mut::<Heading>() {
|
||||||
b.alter_classes(
|
h.alter_classes(
|
||||||
ClassesOp::Replace(b.font_size().to_string()),
|
ClassesOp::Replace(h.size().to_string()),
|
||||||
with_font(b.font_size()),
|
match h.size() {
|
||||||
);
|
HeadingSize::ExtraLarge => "display-1",
|
||||||
}
|
HeadingSize::XxLarge => "display-2",
|
||||||
}
|
HeadingSize::XLarge => "display-3",
|
||||||
t if t == TypeId::of::<Heading>() => {
|
HeadingSize::Large => "display-4",
|
||||||
if let Some(h) = component_as_mut::<Heading>(component) {
|
HeadingSize::Medium => "display-5",
|
||||||
h.alter_classes(
|
_ => "",
|
||||||
ClassesOp::Replace(h.size().to_string()),
|
},
|
||||||
match h.size() {
|
);
|
||||||
HeadingSize::ExtraLarge => "display-1",
|
} else if let Some(p) = component.downcast_mut::<Paragraph>() {
|
||||||
HeadingSize::XxLarge => "display-2",
|
p.alter_classes(
|
||||||
HeadingSize::XLarge => "display-3",
|
ClassesOp::Replace(p.font_size().to_string()),
|
||||||
HeadingSize::Large => "display-4",
|
with_font(p.font_size()),
|
||||||
HeadingSize::Medium => "display-5",
|
);
|
||||||
_ => "",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
t if t == TypeId::of::<Paragraph>() => {
|
|
||||||
if let Some(p) = component_as_mut::<Paragraph>(component) {
|
|
||||||
p.alter_classes(
|
|
||||||
ClassesOp::Replace(p.font_size().to_string()),
|
|
||||||
with_font(p.font_size()),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_component(&self, component: &dyn ComponentTrait, cx: &mut Context) -> Option<Markup> {
|
fn render_component(&self, component: &dyn ComponentTrait, cx: &mut Context) -> Option<Markup> {
|
||||||
match component.type_id() {
|
if component.downcast_ref::<Layout>().is_some() {
|
||||||
t if t == TypeId::of::<Layout>() => Some(
|
Some(
|
||||||
match cx.layout() {
|
match cx.layout() {
|
||||||
"admin" => Container::new().add_item(
|
"admin" => Container::new().add_item(
|
||||||
Flex::new()
|
Flex::new()
|
||||||
|
|
@ -134,8 +120,9 @@ impl ThemeTrait for Bootsier {
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
.render(cx),
|
.render(cx),
|
||||||
),
|
)
|
||||||
t if t == TypeId::of::<Error404>() => Some(html! {
|
} else if component.downcast_ref::<Error404>().is_some() {
|
||||||
|
Some(html! {
|
||||||
div class="jumbotron" {
|
div class="jumbotron" {
|
||||||
div class="media" {
|
div class="media" {
|
||||||
img
|
img
|
||||||
|
|
@ -165,8 +152,9 @@ impl ThemeTrait for Bootsier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
_ => None,
|
} else {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,57 +41,43 @@ impl ThemeTrait for Bulmix {
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
fn before_prepare_component(&self, component: &mut dyn ComponentTrait, _cx: &mut Context) {
|
fn before_prepare_component(&self, component: &mut dyn ComponentTrait, _cx: &mut Context) {
|
||||||
match component.type_id() {
|
if let Some(i) = component.downcast_mut::<Icon>() {
|
||||||
t if t == TypeId::of::<Icon>() => {
|
i.alter_classes(
|
||||||
if let Some(i) = component_as_mut::<Icon>(component) {
|
ClassesOp::Replace(i.font_size().to_string()),
|
||||||
i.alter_classes(
|
with_font(i.font_size()),
|
||||||
ClassesOp::Replace(i.font_size().to_string()),
|
);
|
||||||
with_font(i.font_size()),
|
} else if let Some(b) = component.downcast_mut::<Button>() {
|
||||||
);
|
b.alter_classes(ClassesOp::Replace("button__tap".to_owned()), "button");
|
||||||
|
b.alter_classes(
|
||||||
|
ClassesOp::Replace(b.style().to_string()),
|
||||||
|
match b.style() {
|
||||||
|
StyleBase::Default => "is-primary",
|
||||||
|
StyleBase::Info => "is-info",
|
||||||
|
StyleBase::Success => "is-success",
|
||||||
|
StyleBase::Warning => "is-warning",
|
||||||
|
StyleBase::Danger => "is-danger",
|
||||||
|
StyleBase::Light => "is-light",
|
||||||
|
StyleBase::Dark => "is-dark",
|
||||||
|
StyleBase::Link => "is-text",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
b.alter_classes(
|
||||||
|
ClassesOp::Replace(b.font_size().to_string()),
|
||||||
|
with_font(b.font_size()),
|
||||||
|
);
|
||||||
|
} else if let Some(h) = component.downcast_mut::<Heading>() {
|
||||||
|
match h.size() {
|
||||||
|
HeadingSize::Subtitle => {
|
||||||
|
h.alter_classes(ClassesOp::Replace(h.size().to_string()), "subtitle")
|
||||||
}
|
}
|
||||||
}
|
_ => h.alter_classes(ClassesOp::Add, "title"),
|
||||||
t if t == TypeId::of::<Button>() => {
|
};
|
||||||
if let Some(b) = component_as_mut::<Button>(component) {
|
} else if let Some(p) = component.downcast_mut::<Paragraph>() {
|
||||||
b.alter_classes(ClassesOp::Replace("button__tap".to_owned()), "button");
|
p.alter_classes(ClassesOp::Add, "block");
|
||||||
b.alter_classes(
|
p.alter_classes(
|
||||||
ClassesOp::Replace(b.style().to_string()),
|
ClassesOp::Replace(p.font_size().to_string()),
|
||||||
match b.style() {
|
with_font(p.font_size()),
|
||||||
StyleBase::Default => "is-primary",
|
);
|
||||||
StyleBase::Info => "is-info",
|
|
||||||
StyleBase::Success => "is-success",
|
|
||||||
StyleBase::Warning => "is-warning",
|
|
||||||
StyleBase::Danger => "is-danger",
|
|
||||||
StyleBase::Light => "is-light",
|
|
||||||
StyleBase::Dark => "is-dark",
|
|
||||||
StyleBase::Link => "is-text",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
b.alter_classes(
|
|
||||||
ClassesOp::Replace(b.font_size().to_string()),
|
|
||||||
with_font(b.font_size()),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
t if t == TypeId::of::<Heading>() => {
|
|
||||||
if let Some(h) = component_as_mut::<Heading>(component) {
|
|
||||||
match h.size() {
|
|
||||||
HeadingSize::Subtitle => {
|
|
||||||
h.alter_classes(ClassesOp::Replace(h.size().to_string()), "subtitle")
|
|
||||||
}
|
|
||||||
_ => h.alter_classes(ClassesOp::Add, "title"),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
t if t == TypeId::of::<Paragraph>() => {
|
|
||||||
if let Some(p) = component_as_mut::<Paragraph>(component) {
|
|
||||||
p.alter_classes(ClassesOp::Add, "block");
|
|
||||||
p.alter_classes(
|
|
||||||
ClassesOp::Replace(p.font_size().to_string()),
|
|
||||||
with_font(p.font_size()),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,17 +86,13 @@ impl ThemeTrait for Bulmix {
|
||||||
component: &dyn ComponentTrait,
|
component: &dyn ComponentTrait,
|
||||||
_cx: &mut Context,
|
_cx: &mut Context,
|
||||||
) -> Option<Markup> {
|
) -> Option<Markup> {
|
||||||
match component.type_id() {
|
if let Some(i) = component.downcast_ref::<Icon>() {
|
||||||
t if t == TypeId::of::<Icon>() => {
|
return match i.icon_name().get() {
|
||||||
if let Some(i) = component_as_ref::<Icon>(component) {
|
None => None,
|
||||||
return match i.icon_name().get() {
|
_ => Some(html! { span class="icon" { i class=[i.classes().get()] {} } }),
|
||||||
None => None,
|
};
|
||||||
_ => Some(html! { span class="icon" { i class=[i.classes().get()] {} } }),
|
} else {
|
||||||
};
|
None
|
||||||
}
|
|
||||||
None
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ impl<C: ComponentTrait> AfterPrepareComponent<C> {
|
||||||
pub(crate) fn dispatch(component: &mut C, cx: &mut Context, referer_id: Option<String>) {
|
pub(crate) fn dispatch(component: &mut C, cx: &mut Context, referer_id: Option<String>) {
|
||||||
dispatch_actions(
|
dispatch_actions(
|
||||||
(TypeId::of::<Self>(), Some(TypeId::of::<C>()), referer_id),
|
(TypeId::of::<Self>(), Some(TypeId::of::<C>()), referer_id),
|
||||||
|action| (action_ref::<AfterPrepareComponent<C>>(&**action).f)(component, cx),
|
|action: &Self| (action.f)(component, cx),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ impl<C: ComponentTrait> BeforePrepareComponent<C> {
|
||||||
pub(crate) fn dispatch(component: &mut C, cx: &mut Context, referer_id: Option<String>) {
|
pub(crate) fn dispatch(component: &mut C, cx: &mut Context, referer_id: Option<String>) {
|
||||||
dispatch_actions(
|
dispatch_actions(
|
||||||
(TypeId::of::<Self>(), Some(TypeId::of::<C>()), referer_id),
|
(TypeId::of::<Self>(), Some(TypeId::of::<C>()), referer_id),
|
||||||
|action| (action_ref::<BeforePrepareComponent<C>>(&**action).f)(component, cx),
|
|action: &Self| (action.f)(component, cx),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ impl AfterPrepareBody {
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub(crate) fn dispatch(page: &mut Page) {
|
pub(crate) fn dispatch(page: &mut Page) {
|
||||||
dispatch_actions((TypeId::of::<Self>(), None, None), |action| {
|
dispatch_actions((TypeId::of::<Self>(), None, None), |action: &Self| {
|
||||||
(action_ref::<AfterPrepareBody>(&**action).f)(page)
|
(action.f)(page)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ impl BeforePrepareBody {
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub(crate) fn dispatch(page: &mut Page) {
|
pub(crate) fn dispatch(page: &mut Page) {
|
||||||
dispatch_actions((TypeId::of::<Self>(), None, None), |action| {
|
dispatch_actions((TypeId::of::<Self>(), None, None), |action: &Self| {
|
||||||
(action_ref::<BeforePrepareBody>(&**action).f)(page)
|
(action.f)(page)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
42
src/core.rs
42
src/core.rs
|
|
@ -6,6 +6,8 @@ use std::any::Any;
|
||||||
|
|
||||||
// Common definitions for core types.
|
// Common definitions for core types.
|
||||||
pub trait AnyBase: Any {
|
pub trait AnyBase: Any {
|
||||||
|
fn type_name(&self) -> &'static str;
|
||||||
|
|
||||||
fn single_name(&self) -> &'static str;
|
fn single_name(&self) -> &'static str;
|
||||||
|
|
||||||
fn as_any_ref(&self) -> &dyn Any;
|
fn as_any_ref(&self) -> &dyn Any;
|
||||||
|
|
@ -14,19 +16,55 @@ pub trait AnyBase: Any {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Any> AnyBase for T {
|
impl<T: Any> AnyBase for T {
|
||||||
fn single_name(&self) -> &'static str {
|
#[inline(always)]
|
||||||
util::single_type_name::<Self>()
|
fn type_name(&self) -> &'static str {
|
||||||
|
std::any::type_name::<T>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
fn single_name(&self) -> &'static str {
|
||||||
|
util::single_type_name::<T>()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
fn as_any_ref(&self) -> &dyn Any {
|
fn as_any_ref(&self) -> &dyn Any {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
fn as_any_mut(&mut self) -> &mut dyn Any {
|
fn as_any_mut(&mut self) -> &mut dyn Any {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait AnyTo: AnyBase {
|
||||||
|
#[inline]
|
||||||
|
fn is<T>(&self) -> bool
|
||||||
|
where
|
||||||
|
T: AnyBase,
|
||||||
|
{
|
||||||
|
self.as_any_ref().is::<T>()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn downcast_ref<T>(&self) -> Option<&T>
|
||||||
|
where
|
||||||
|
T: AnyBase,
|
||||||
|
{
|
||||||
|
self.as_any_ref().downcast_ref()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn downcast_mut<T>(&mut self) -> Option<&mut T>
|
||||||
|
where
|
||||||
|
T: AnyBase,
|
||||||
|
{
|
||||||
|
self.as_any_mut().downcast_mut()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: ?Sized + AnyBase> AnyTo for T {}
|
||||||
|
|
||||||
// API to define functions that alter the behavior of PageTop core.
|
// API to define functions that alter the behavior of PageTop core.
|
||||||
pub mod action;
|
pub mod action;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
mod definition;
|
mod definition;
|
||||||
pub use definition::{action_ref, ActionTrait};
|
pub use definition::ActionTrait;
|
||||||
|
|
||||||
mod list;
|
mod list;
|
||||||
pub use list::Action;
|
pub use list::Action;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::core::action::{Action, ActionsList};
|
use crate::core::action::{Action, ActionTrait, ActionsList};
|
||||||
use crate::{LazyStatic, TypeId};
|
use crate::{LazyStatic, TypeId};
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
@ -24,9 +24,10 @@ pub fn add_action(action: Action) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dispatch_actions<B, F>(key_action: KeyAction, f: F)
|
pub fn dispatch_actions<A, B, F>(key_action: KeyAction, f: F)
|
||||||
where
|
where
|
||||||
F: FnMut(&Action) -> B,
|
A: ActionTrait,
|
||||||
|
F: FnMut(&A) -> B,
|
||||||
{
|
{
|
||||||
if let Some(list) = ACTIONS.read().unwrap().get(&key_action) {
|
if let Some(list) = ACTIONS.read().unwrap().get(&key_action) {
|
||||||
list.iter_map(f)
|
list.iter_map(f)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,3 @@ pub trait ActionTrait: AnyBase + Send + Sync {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn action_ref<A: 'static>(action: &dyn ActionTrait) -> &A {
|
|
||||||
action.as_any_ref().downcast_ref::<A>().unwrap()
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
use crate::core::action::ActionTrait;
|
use crate::core::action::ActionTrait;
|
||||||
|
use crate::core::AnyTo;
|
||||||
|
use crate::trace;
|
||||||
use crate::AutoDefault;
|
use crate::AutoDefault;
|
||||||
|
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
|
|
@ -21,12 +23,25 @@ impl ActionsList {
|
||||||
list.sort_by_key(|a| a.weight());
|
list.sort_by_key(|a| a.weight());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter_map<B, F>(&self, f: F)
|
pub fn iter_map<A, B, F>(&self, mut f: F)
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
F: FnMut(&Action) -> B,
|
A: ActionTrait,
|
||||||
|
F: FnMut(&A) -> B,
|
||||||
{
|
{
|
||||||
let _: Vec<_> = self.0.read().unwrap().iter().map(f).collect();
|
let _: Vec<_> = self
|
||||||
|
.0
|
||||||
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.map(|a| {
|
||||||
|
if let Some(action) = (&**a).downcast_ref::<A>() {
|
||||||
|
f(action);
|
||||||
|
} else {
|
||||||
|
trace::error!("Failed to downcast action of type {}", (&**a).type_name());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ mod renderable;
|
||||||
pub use renderable::{FnIsRenderable, Renderable};
|
pub use renderable::{FnIsRenderable, Renderable};
|
||||||
|
|
||||||
mod definition;
|
mod definition;
|
||||||
pub use definition::{component_as_mut, component_as_ref, ComponentBase, ComponentTrait};
|
pub use definition::{ComponentBase, ComponentTrait};
|
||||||
|
|
||||||
mod classes;
|
mod classes;
|
||||||
pub use classes::{ComponentClasses, ComponentClassesOp};
|
pub use classes::{ComponentClasses, ComponentClassesOp};
|
||||||
|
|
|
||||||
|
|
@ -83,11 +83,3 @@ impl<C: ComponentTrait> ComponentBase for C {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn component_as_ref<C: ComponentTrait>(component: &dyn ComponentTrait) -> Option<&C> {
|
|
||||||
component.as_any_ref().downcast_ref::<C>()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn component_as_mut<C: ComponentTrait>(component: &mut dyn ComponentTrait) -> Option<&mut C> {
|
|
||||||
component.as_any_mut().downcast_mut::<C>()
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ pub trait ThemeTrait: PackageTrait + Send + Sync {
|
||||||
|
|
||||||
match component.type_id() {
|
match component.type_id() {
|
||||||
t if t == TypeId::of::<Block>() => {
|
t if t == TypeId::of::<Block>() => {
|
||||||
if let Some(b) = component_as_mut::<Block>(component) {
|
if let Some(b) = component.downcast_mut::<Block>() {
|
||||||
b.alter_title("New title");
|
b.alter_title("New title");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -114,7 +114,7 @@ pub trait ThemeTrait: PackageTrait + Send + Sync {
|
||||||
|
|
||||||
match component.type_id() {
|
match component.type_id() {
|
||||||
t if t == TypeId::of::<Block>() => {
|
t if t == TypeId::of::<Block>() => {
|
||||||
if let Some(b) = component_as_mut::<Block>(component) {
|
if let Some(b) = component.downcast_mut::<Block>() {
|
||||||
b.alter_title("New title");
|
b.alter_title("New title");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ pub use crate::{db, db::*, migrations, new_migration};
|
||||||
pub use crate::service;
|
pub use crate::service;
|
||||||
pub use crate::service::{HttpMessage, HttpRequest};
|
pub use crate::service::{HttpMessage, HttpRequest};
|
||||||
|
|
||||||
pub use crate::core::AnyBase;
|
pub use crate::core::{AnyBase, AnyTo};
|
||||||
|
|
||||||
pub use crate::core::action::*;
|
pub use crate::core::action::*;
|
||||||
pub use crate::core::component::*;
|
pub use crate::core::component::*;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue