add_message adds a new event to the call stack and calls run.
run checks the the call stack is not empty and calls next_message.
next_message pops the call stack, executes, and calls run.
As you can see, there is a recursive pattern between run and next_message because the functions call each other back and forth until the entire call stack is cleared. While they are executing, can events happen in between? Let's say the user clicks something, this should call add_message. Can add_message executes while run and next_message call each other?
If Yes, how would that work because I do not see any signs of multi-threaded rust code.
If No, wouldn't this lead to an unresponsive web app because the entire call stack would need to be cleared before the user can do anything.
Summary
Can TODO MVC handle asynchronous events?
The documentation claims that
Does it also emulate the ability to handle asynchronous events?
Additional Details
I will provide a high level overview of this file
add_message
adds a new event to the call stack and callsrun
.run
checks the the call stack is not empty and callsnext_message
.next_message
pops the call stack, executes, and callsrun
.As you can see, there is a recursive pattern between
run
andnext_message
because the functions call each other back and forth until the entire call stack is cleared. While they are executing, can events happen in between? Let's say the user clicks something, this should calladd_message
. Canadd_message
executes whilerun
andnext_message
call each other?If Yes, how would that work because I do not see any signs of multi-threaded rust code.
If No, wouldn't this lead to an unresponsive web app because the entire call stack would need to be cleared before the user can do anything.