MCPcopy Create free account
hub / github.com/daisy/MathCAT / pop_stack

Function pop_stack

src/navigate.rs:479–499  ·  view source on GitHub ↗
(nav_state: &mut NavigationState, count: usize)

Source from the content-addressed store, hash-verified

477 }
478
479 fn pop_stack(nav_state: &mut NavigationState, count: usize) {
480 // save the final state and pop the intermediate states that did nothing
481 if count == 0 {
482 return;
483 }
484
485 let (top_position, top_command) = nav_state.pop().unwrap();
486 let mut count = count-1;
487 loop {
488 // debug!(" ... loop count={}", count);
489 let (_, nav_command) = nav_state.top().unwrap();
490 if (nav_command.starts_with("Move") || nav_command.starts_with("Zoom")) && nav_command != "MoveLastLocation" {
491 nav_state.pop();
492 }
493 if count == 0 {
494 break;
495 };
496 count -= 1;
497 };
498 nav_state.push(top_position, top_command);
499 }
500}
501
502fn speak<'r, 'c, 's:'c, 'm:'c>(rules_with_context: &'r mut SpeechRulesWithContext<'c,'s,'m>, mathml: Element<'c>, nav_node_id: String, full_read: bool) -> Result<String> {

Callers 1

apply_navigation_rulesFunction · 0.85

Calls 3

topMethod · 0.80
popMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected