pub trait PollMessage<TargetState, Message>: StateMachinewhere
TargetState: State + ReturnMessage<Message>,{
// Required method
fn poll_message(&mut self) -> Result<Option<Message>, MessageError<()>>;
}Expand description
The PollMessage trait implementation will be generated by the add_message! macro and is used to return messages from states.
Required Methods§
Sourcefn poll_message(&mut self) -> Result<Option<Message>, MessageError<()>>
fn poll_message(&mut self) -> Result<Option<Message>, MessageError<()>>
This will call the return_message function of FooState if it implemented the ReturnMessage
trait for message ‘FooMessage’ and it has been declared to do so with the add_message! macro.
ⓘ
use sfsm_base::PollMessage;
let some_message = PollMessage::<FooState, FooMessage>::poll_message(&mut sfsm);