Mercurial > lbo > hg > rex
changeset 64:4d2feb7c37f7
state: Fix dot output.
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Fri, 30 Aug 2019 22:52:09 +0200 |
parents | 0704050ff42a |
children | 094c91f3213f |
files | src/state.rs |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/state.rs Fri Aug 30 22:49:34 2019 +0200 +++ b/src/state.rs Fri Aug 30 22:52:09 2019 +0200 @@ -94,18 +94,16 @@ let mut visited = HashSet::new(); let mut todo = LinkedList::from_iter(vec![0 as StateRef]); - let mut id = 0; loop { - id += 1; if todo.is_empty() { break; } let current = todo.pop_front().unwrap(); - if visited.contains(&id) { + if visited.contains(¤t) { continue; } - visited.insert(id.clone()); + visited.insert(current); for next in [stateg[current].out.clone(), stateg[current].out1.clone()].into_iter() { if let &Some(nextid) = next { @@ -113,7 +111,7 @@ write!( &mut result, "\"{} {}\" -> \"{} {}\";\n", - id, + current, stateg[current].to_string(), nextid, o.to_string(),