mirror of
https://github.com/zaphar/sycamore-state.git
synced 2025-07-25 21:00:17 -04:00
Make dispatch a public method
This commit is contained in:
parent
cad0b2ecb7
commit
66d1307f1b
@ -54,7 +54,8 @@ where
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch(&self, msg: Msg) {
|
/// Directly handle a state message without requiring a binding.
|
||||||
|
pub fn dispatch(&self, msg: Msg) {
|
||||||
self.signal.set(self.dispatcher.map(msg, self.signal))
|
self.signal.set(self.dispatcher.map(msg, self.signal))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,19 @@ pub struct FakeState {
|
|||||||
value_two: i32,
|
value_two: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub enum MultiMsg {
|
||||||
|
Foo(Msg),
|
||||||
|
Bar(Msg),
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct MultiState<'ctx, D>
|
||||||
|
where
|
||||||
|
D: MessageMapper<Msg, FakeState>,
|
||||||
|
{
|
||||||
|
foo: &'ctx Handler<'ctx, D, FakeState, Msg>,
|
||||||
|
bar: &'ctx Handler<'ctx, D, FakeState, Msg>,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct StateMachine();
|
pub struct StateMachine();
|
||||||
|
|
||||||
impl MessageMapper<Msg, FakeState> for StateMachine {
|
impl MessageMapper<Msg, FakeState> for StateMachine {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user