Rust/wasm32, displaying sequence of HTML5 Forms


A -> B -> C1 -> D1 -> E1
     |    |  
     |    +---> D2 -> E2 
     |          |
     |          +---> E3
     |--> C2 -> D3 -> E4
          +---> D4 -> E5
          |     |
          |     +---> E6
          +---> D4 -> E7

Where every $Letter$Num is a HTML5 Form.

At each form, the user enters some info, clicks some button, and depending on button clicked, goes to a different form. For example,

  • D4 can go to either E5 or E6
  • D4 always goes to E7.

So now the issue is what primitives to use to implement this.

In a language with continuations, each Form would do it's own work, then return a continuation for how to continue.

In a language like Go (or any with cooperative threads), we could dedicate a go-routine to this, and have it yield after setting up each form.

With Rust/wasm32, the only two options I know of are (1) manually "compile" this graph down to an state machine represented as an Enum or (2) deal with "callback hell."

I'm sure this is a common problem. What are the current Rust best practices for solving this?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.