chiark / gitweb /
errors: Rename POE type alias to Ia
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Jul 2021 14:10:23 +0000 (15:10 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Jul 2021 14:10:23 +0000 (15:10 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs
src/error.rs
src/global.rs
src/hidden.rs
src/organise.rs
src/prelude.rs

index 8e4a597d04a12668ad4d2d6dd687f09a9267230b..30d144ae454b1a6e405245f7c49e7c54f16b1f01 100644 (file)
@@ -125,7 +125,7 @@ fn api_piece_op<O: op::Complex>(form: Json<ApiPiece<O>>)
   let was_held = gs.pieces.get(piece).as_ref().map(|gpc| gpc.held);
 
   match (||{
-    let ipc = ipieces.get(piece).ok_or(POE::PieceGone)?;
+    let ipc = ipieces.get(piece).ok_or(Ia::PieceGone)?;
     let gpc = gs.pieces.byid_mut(piece)?;
 
     let q_gen = form.gen;
@@ -321,7 +321,7 @@ api_route!{
 
       let gpl = players.byid_mut(player)?;
       let pri = piece_pri(ioccults, &gs.occults, player, gpl, piece, gpc, ipc)
-        .ok_or(POE::PieceGone)?;
+        .ok_or(Ia::PieceGone)?;
 
       let pcs = pri.describe(ioccults,&gs.occults, gpc, ipc);
 
@@ -400,7 +400,7 @@ api_route!{
       ioccults,&gs.occults,gpl,gpc,ipc,
       "released"
     )?;
-    let who_by = who_by.ok_or(POE::PieceGone)?;
+    let who_by = who_by.ok_or(Ia::PieceGone)?;
 
     if gpc.held != Some(player) { throw!(Fatal::PieceHeld) }
     gpc.held = None;
@@ -512,7 +512,7 @@ api_route!{
     let ApiPieceOpArgs { gs,ioccults,player,piece,ipc, .. } = a;
     let gpc = gs.pieces.byid_mut(piece).unwrap();
     if ! gpc.rotateable() || gpc.occult.is_active() {
-      throw!(POE::PieceUnrotateable)
+      throw!(Ia::PieceUnrotateable)
     }
     let gpl = gs.players.byid_mut(player).unwrap();
     let logents = log_did_to_piece(
@@ -567,7 +567,7 @@ api_route!{
                           player, gs.players.byid_mut(player)?,
                           piece, gs.pieces.byid(piece)?,
                           ipc)
-        .ok_or(POE::PieceGone)?;
+        .ok_or(Ia::PieceGone)?;
       let y = {
         use PriOG::*;
         match pri.occulted {
index 22dfc84c4cf775944d0d333f3ed59b73d7794f5f..7b4c4cd75fdb37c0b5350b59b8e5ac388bf92ea8 100644 (file)
@@ -267,8 +267,8 @@ impl<T> IdForById for T where T: AccessId {
 }
 
 impl IdForById for PieceId {
-  type Error = POE;
-  const ERROR: POE = POE::PieceGone;
+  type Error = Ia;
+  const ERROR: Ia = Ia::PieceGone;
 }
 
 #[macro_export]
index 76e95dbc09de8a9445baa4000e2c1632e91b7271..f135d538d0cc1a08d3f24ca595ff068899e5a2e3 100644 (file)
@@ -1417,13 +1417,13 @@ impl ById for GPieces {
   type Id = PieceId;
   type Entry = GPiece;
   type Error = Inapplicable;
-  #[throws(POE)]
+  #[throws(Ia)]
   fn byid(&self, piece: PieceId) -> &GPiece {
-    self.get(piece).ok_or(POE::PieceGone)?
+    self.get(piece).ok_or(Ia::PieceGone)?
   }
-  #[throws(POE)]
+  #[throws(Ia)]
   fn byid_mut(&mut self, piece: PieceId) -> &mut GPiece {
-    self.get_mut(piece).ok_or(POE::PieceGone)?
+    self.get_mut(piece).ok_or(Ia::PieceGone)?
   }
 }
 
index 3228fda03a6ae24a5966654acf767816c044b289..f768fb0fae3cb30c96586acb4b6ea1c4f0d67435 100644 (file)
@@ -429,7 +429,7 @@ impl GPiece {
 
   pub fn occulter_check_unrotated(&self, _:ShowUnocculted)
       -> Result<OcculterRotationChecked, Inapplicable> {
-    if self.angle.is_rotated() { Err(POE::OcculterAlreadyRotated) }
+    if self.angle.is_rotated() { Err(Ia::OcculterAlreadyRotated) }
     else { Ok(OcculterRotationChecked(())) }
   }
 
index 306193403d339566dde7f552f3da2a8c4ebb2697..d9b4f94134a6e51d323b3af77f284807c152bceb 100644 (file)
@@ -128,7 +128,7 @@ fn recover_order(region: &Rect, pieces: &Primary, zlevels: &ZLevels)
 
   // This algorithm is quadratic.  320^2 = 102K
   let len = pieces.len();
-  if len > 320 { throw!(POE::OrganisedPlacementOverfull) }
+  if len > 320 { throw!(Ia::OrganisedPlacementOverfull) }
 
   let mut remain: Vec<InHand> = (0..len).map(Into::into).collect();
   let mut out = index_vec![];
@@ -290,11 +290,11 @@ pub fn ui_operation(a: &mut ApiPieceOpArgs<'_>, _: OcculterRotationChecked,
   for &pos in &layout {
     // Some sanity checks
     pos.clamped(gs.table_size).map_err(
-      |_| APOE::Inapplicable(POE::PosOffTable))?;
+      |_| APOE::Inapplicable(Ia::PosOffTable))?;
     match gs.occults.pos_occulter(&gs.occults, pos)? {
       None => {},
       Some(occulter) if occulter == apiece => {},
-      Some(_) => throw!(APOE::Inapplicable(POE::Occultation)),
+      Some(_) => throw!(APOE::Inapplicable(Ia::Occultation)),
     };
   }
 
index afc9aada36c259ea9513c71df63f7789a807995d..83b6d9a19f3d91baf64d230758337d9037fe7a30 100644 (file)
@@ -197,7 +197,7 @@ pub type APOE = ApiPieceOpError;
 pub type ESVU<POEPU> = ErrorSignaledViaUpdate<POEPU>;
 pub type IE = InternalError;
 pub type OE = Fatal; // xxx get rid of this alyas when we've cleaned up Fatal
-pub type POE = Inapplicable; // xxx rename this alias
+pub type Ia = Inapplicable;
 pub type POEPP = PieceOpErrorPartiallyProcessed;
 pub type SvgE = SVGProcessingError;
 pub type SpE = SpecError;