chiark / gitweb /
updates: Change type aliases POU and PUOs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 11 Feb 2021 19:17:56 +0000 (19:17 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 12 Feb 2021 01:38:24 +0000 (01:38 +0000)
Now we have aliases for both the singular and plural types

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/cmdlistener.rs
src/imports.rs
src/updates.rs

index 546c09d7108f1c8752d3119b88ad961b49238cbb..24a2e8687c14c6073144210cc397eb070af1c6a2 100644 (file)
@@ -806,7 +806,7 @@ impl UpdateHandler {
         let estimate = updates.pcs.len() + updates.log.len();
         let mut buf = PrepareUpdatesBuffer::new(g, None, Some(estimate));
         for (upiece, uuop) in updates.pcs {
-          buf.piece_update(upiece, PUO::Simple(uuop));
+          buf.piece_update(upiece, PUOs::Simple(uuop));
         }
         buf.log_updates(updates.log);
         buf.raw_updates(raw);
@@ -821,7 +821,7 @@ impl UpdateHandler {
       Bulk(bulk) => {
         let mut buf = PrepareUpdatesBuffer::new(g, None, None);
         for (upiece, uuop) in bulk.pieces {
-          buf.piece_update(upiece, PUO::Simple(uuop));
+          buf.piece_update(upiece, PUOs::Simple(uuop));
         }
 
         if bulk.logs {
index 6443dcb96dcdc6da76b57df29176ce9d4fc579d4..42d6fbf17880f0a6dd4127d0d6ff6f87deb2b123 100644 (file)
@@ -133,5 +133,6 @@ pub type POEPP = PieceOpErrorPartiallyProcessed;
 
 // updates.rs
 pub type PUE = PreparedUpdateEntry;
-pub type PUO = PieceUpdateOps;
+pub type PUO<NS,ZL> = PieceUpdateOp<NS,ZL>;
+pub type PUOs = PieceUpdateOps;
 pub type WRC = WhatResponseToClientOp;
index 0f8187c3e40a0cfa8972fc9a4e7519265cdfa45d..ee8002cde2806103188fa39a3dcfaf5043d1b77b 100644 (file)
@@ -123,7 +123,7 @@ pub enum PieceUpdateOps {
 }
 
 impl From<PieceUpdateOp<(),()>> for PieceUpdateOps {
-  fn from(op: PieceUpdateOp<(),()>) -> Self { PUO::Simple(op) }
+  fn from(op: PieceUpdateOp<(),()>) -> Self { PUOs::Simple(op) }
 }
 
 impl From<PieceUpdateFromOpSimple> for PieceUpdate {
@@ -434,7 +434,7 @@ impl<'r> PrepareUpdatesBuffer<'r> {
                             -> Result<(),OE> {
     let by_client = (WRC::Unpredictable, client, cseq);
     let mut buf = PrepareUpdatesBuffer::new(ig, Some(by_client), None);
-    let ops = PUO::Simple(PieceUpdateOp::Modify(()));
+    let ops = PUOs::Simple(PieceUpdateOp::Modify(()));
     let state = buf.piece_update_fallible(
       piece, ops, |pc, gen, _by_client| {
         match partially {
@@ -498,8 +498,8 @@ impl<'r> PrepareUpdatesBuffer<'r> {
     let mut out: SecondarySlotMap<PlayerId, PreparedPieceUpdate> = default();
     for (player, gpl) in &mut gs.players {
       let ops = match ops {
-        PUO::Simple(update) => update,
-        PUO::PerPlayer(ref ops) => match ops.get(player) {
+        PUOs::Simple(update) => update,
+        PUOs::PerPlayer(ref ops) => match ops.get(player) {
           Some(op) => *op,
           None => continue,
         }