pub trait PushMessage<TargetState, Message>: StateMachinewhere
TargetState: State + ReceiveMessage<Message>,{
// Required method
fn push_message(
&mut self,
message: Message,
) -> Result<(), MessageError<Message>>;
}Expand description
The PushMessage trait implementation will be generated by the add_message! macro and is used to send messages into the state machine where they will then be forwarded to the correct state.
Required Methods§
Sourcefn push_message(
&mut self,
message: Message,
) -> Result<(), MessageError<Message>>
fn push_message( &mut self, message: Message, ) -> Result<(), MessageError<Message>>
This will call the receive_message function of FooState if it implemented the ReceiveMessage
trait for message ‘FooMessage’ and it has been declared to do so with the add_message! macro.
ⓘ
use sfsm_base::PushMessage;
let some_message = 2u32;
PushMessage::<FooState, FooMessage>::push_message(&mut sfsm, some_message);