chiark / gitweb /
extension traits: Use extend::ext
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 8 Mar 2021 20:51:35 +0000 (20:51 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 8 Mar 2021 20:51:35 +0000 (20:51 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
wdriver.rs

index 5ca93d2bf563f3a79e8f0626431a3672aede264e..4a334a2a48689d7858d8c76088db701f6c7a0ffa 100644 (file)
@@ -554,20 +554,18 @@ impl IntoInWindow<WebPos> for Pos {
   }
 }
 
-pub trait ActionChainExt: Sized {
+#[ext(pub, name=ActionChainExt, supertraits=Sized)]
+impl<'a> t4::action_chain::ActionChain<'a> {
+  #[throws(AE)]
   fn move_w<'g, P: Debug + Copy + IntoInWindow<WebPos>>
-    (self, w: &'g WindowGuard, pos: P) -> Result<Self,AE>;
-
-  fn move_pos<'g,
-              E,
-              P: TryInto<WebPos, Error=E>>
-    (self, pos: P) -> Result<Self,AE>
-    where Result<WebPos,E>: anyhow::Context<WebPos,E>;
-
-  fn move_pc<'g>(self, w: &'g WindowGuard, pc: &str) -> Result<Self, AE>;
-}
+    (self, w: &'g WindowGuard, pos: P) -> Self
+  {
+    let pos: WebPos = pos.w_into(w)
+      .with_context(|| format!("{:?}", pos))
+      .context("find coordinate")?;
+    self.move_pos(pos)?
+  }
 
-impl<'a> ActionChainExt for t4::action_chain::ActionChain<'a> {
   #[throws(AE)]
   fn move_pos<'g,
               E,
@@ -580,16 +578,6 @@ impl<'a> ActionChainExt for t4::action_chain::ActionChain<'a> {
     self.move_to(px,py)
   }
 
-  #[throws(AE)]
-  fn move_w<'g, P: Debug + Copy + IntoInWindow<WebPos>>
-    (self, w: &'g WindowGuard, pos: P) -> Self
-  {
-    let pos: WebPos = pos.w_into(w)
-      .with_context(|| format!("{:?}", pos))
-      .context("find coordinate")?;
-    self.move_pos(pos)?
-  }
-
   #[throws(AE)]
   fn move_pc<'g>(self, w: &'g WindowGuard, pc: &str) -> Self {
     (||{