pub struct Flow {
pub wizard: String,
pub at: String,
pub values: Values,
pub initial: Values,
pub passed: Vec<String>,
}Expand description
A wizard being filled: the step shown, the draft, the steps passed.
Fields§
§wizard: String§at: StringA step’s id, or SUMMARY.
values: Values§initial: ValuesThe draft at the start: what Cancel compares with.
passed: Vec<String>The steps left by Next or Skip (the stepper marks them done).
Implementations§
Source§impl Flow
impl Flow
Sourcepub fn start(w: &Wizard, base: &WhenContext, values: Values) -> Flow
pub fn start(w: &Wizard, base: &WhenContext, values: Values) -> Flow
A flow at its first step, its draft the defaults with values
over them.
Sourcepub fn context(&self, base: &WhenContext) -> WhenContext
pub fn context(&self, base: &WhenContext) -> WhenContext
The context its clauses read: the application’s, and the draft as
form.<key>.
Sourcepub fn shown<'a>(&self, w: &'a Wizard, base: &WhenContext) -> Vec<&'a Step>
pub fn shown<'a>(&self, w: &'a Wizard, base: &WhenContext) -> Vec<&'a Step>
The steps that exist for the draft as it stands.
Sourcepub fn index(&self, w: &Wizard, base: &WhenContext) -> usize
pub fn index(&self, w: &Wizard, base: &WhenContext) -> usize
Where it stands among the steps shown (the summary after them).
pub fn on_summary(&self) -> bool
Sourcepub fn set(&mut self, w: &Wizard, key: &str, value: Json) -> Result<(), String>
pub fn set(&mut self, w: &Wizard, key: &str, value: Json) -> Result<(), String>
Sets a draft value; refused for a key no field of the wizard has.
Sourcepub fn problems(&self, step: &Step, j: &Judge<'_>) -> Vec<Problem>
pub fn problems(&self, step: &Step, j: &Judge<'_>) -> Vec<Problem>
A step’s problems for the draft as it stands: its fields’ own checks and hooks, then the step’s hook.
Sourcepub fn blocked(&self, step: &Step, j: &Judge<'_>) -> Option<Problem>
pub fn blocked(&self, step: &Step, j: &Judge<'_>) -> Option<Problem>
The first problem that blocks a step (danger), if any.
Sourcepub fn next(&mut self, w: &Wizard, j: &Judge<'_>) -> Result<(), String>
pub fn next(&mut self, w: &Wizard, j: &Judge<'_>) -> Result<(), String>
Next: the step shown checked, then the one after it. Refused with the first blocking problem’s message, or on the last step.
Sourcepub fn skip(&mut self, w: &Wizard, base: &WhenContext) -> Result<(), String>
pub fn skip(&mut self, w: &Wizard, base: &WhenContext) -> Result<(), String>
Skip: an optional step’s values back to their defaults, then the step after it.
Sourcepub fn back(&mut self, w: &Wizard, base: &WhenContext) -> Result<(), String>
pub fn back(&mut self, w: &Wizard, base: &WhenContext) -> Result<(), String>
Back: the step before (the last one from the summary).
Sourcepub fn go(&mut self, w: &Wizard, j: &Judge<'_>, to: &str) -> Result<(), String>
pub fn go(&mut self, w: &Wizard, j: &Judge<'_>, to: &str) -> Result<(), String>
Goes to a step (or the summary): every step before it must be valid, else it lands on the first one that is not and says why.
Sourcepub fn first_blocked(
&self,
w: &Wizard,
j: &Judge<'_>,
) -> Option<(String, Problem)>
pub fn first_blocked( &self, w: &Wizard, j: &Judge<'_>, ) -> Option<(String, Problem)>
Whether every step shown is valid: the summary may be reached and the wizard finished.
Sourcepub fn draft(&self, w: &Wizard, base: &WhenContext) -> Values
pub fn draft(&self, w: &Wizard, base: &WhenContext) -> Values
The draft handed on: the values of the fields shown in the steps
shown (a step or field whose when does not hold hands nothing).