Rather than the clone-and-hack copy. Tidying up, NFC.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
struct Got {
now: Pos,
log: Vec<String>,
- held: serde_json::Value,
+ held: Option<String>,
}
let gots = sides.iter().map(|side|{
.collect::<Result<Vec<String>,_>>()?;
// xxx clone and hack
- let held = w.execute_script(&format!(r##"
- let pc = pieces['{}'];
- return pc.held;
- "##, &pc))?;
- let held = held.value().to_owned();
+ let held = w.piece_held(&pc)?;
Ok::<_,AE>(Got { now, log, held })
}).collect::<Result<Vec<_>,AE>>()?;