pub enum ProceedResult<O, M> {
SendMsg(Outgoing<M>),
NeedsOneMoreMessage,
Output(O),
Yielded,
Error(ExecutionError),
}state-machine only.Expand description
Tells why protocol execution stopped
Variants§
SendMsg(Outgoing<M>)
Protocol needs provided message to be sent
NeedsOneMoreMessage
Protocol needs one more message to be received
After the state machine requested one more message, the next call to the state machine must
be StateMachine::received_msg.
Output(O)
Protocol is finished
Yielded
Protocol yielded the execution
Protocol may yield at any point by calling AsyncRuntime::yield_now. Main motivation
for yielding is to break a long computation into smaller parts, so proceeding state
machine doesn’t take too long.
When protocol yields, you can resume the execution by calling proceed
immediately.
Error(ExecutionError)
State machine failed to carry out the protocol
Error likely means that either state machine is misused (e.g. when proceed
is called after protocol is finished) or protocol implementation is not supported by state machine
executor (e.g. it polls unknown future).