}
}
+impl<'g> TryInto<WebPos> for &'g PieceElement<'g> {
+ type Error = AE;
+ #[throws(AE)]
+ fn try_into(self) -> WebPos {
+ self.posw()?
+ }
+}
+
#[throws(AE)]
fn check_window_name_sanity(name: &str) -> &str {
let e = || anyhow!("bad window name {:?}", &name);
pub trait ActionChainExt: Sized {
fn w_move<'g, P: IntoInWindow<WebPos>>
(self, w: &'g WindowGuard, pos: P) -> Result<Self,AE>;
+
+ fn move_pos<'g, P: TryInto<WebPos, Error=AE>>
+ (self, pos: P) -> Result<Self,AE>;
}
impl<'a> ActionChainExt for t4::action_chain::ActionChain<'a> {
let (px,py) = pos.w_into(w)?;
self.move_to(px,py)
}
+
+ #[throws(AE)]
+ fn move_pos<'g, P: TryInto<WebPos, Error=AE>> (self, pos: P) -> Self {
+ let (px,py) = pos.try_into()?;
+ self.move_to(px,py)
+ }
}
impl Drop for Setup {
let (p2x,p2y) = p2.posw()?;
w.action_chain()
- .w_move(&w, p1.posw()?)?
+ .move_pos(&p1)?
.click_and_hold()
.move_to(p2x + 5, p2y + 10)
.release()