mirror of
https://github.com/zaphar/sycamore-state.git
synced 2025-07-22 20:29:50 -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))
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,19 @@ pub struct FakeState {
|
||||
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();
|
||||
|
||||
impl MessageMapper<Msg, FakeState> for StateMachine {
|
||||
|
Loading…
x
Reference in New Issue
Block a user