From 4d66c9d9356a27797ddc63c6a8434f6868cac1e8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 11 Feb 2021 19:17:56 +0000 Subject: [PATCH] updates: Change type aliases POU and PUOs Now we have aliases for both the singular and plural types Signed-off-by: Ian Jackson --- daemon/cmdlistener.rs | 4 ++-- src/imports.rs | 3 ++- src/updates.rs | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/daemon/cmdlistener.rs b/daemon/cmdlistener.rs index 546c09d7..24a2e868 100644 --- a/daemon/cmdlistener.rs +++ b/daemon/cmdlistener.rs @@ -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 { diff --git a/src/imports.rs b/src/imports.rs index 6443dcb9..42d6fbf1 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -133,5 +133,6 @@ pub type POEPP = PieceOpErrorPartiallyProcessed; // updates.rs pub type PUE = PreparedUpdateEntry; -pub type PUO = PieceUpdateOps; +pub type PUO = PieceUpdateOp; +pub type PUOs = PieceUpdateOps; pub type WRC = WhatResponseToClientOp; diff --git a/src/updates.rs b/src/updates.rs index 0f8187c3..ee8002cd 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -123,7 +123,7 @@ pub enum PieceUpdateOps { } impl From> for PieceUpdateOps { - fn from(op: PieceUpdateOp<(),()>) -> Self { PUO::Simple(op) } + fn from(op: PieceUpdateOp<(),()>) -> Self { PUOs::Simple(op) } } impl From 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 = 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, } -- 2.30.2