From: Ian Jackson Date: Mon, 25 Jan 2021 18:44:21 +0000 (+0000) Subject: introduce TransmitUpdateEntry_Piece (nfc) X-Git-Tag: otter-0.4.0~654 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=57ec09063596e0760b2ba26640f64dc9e3e43138;p=otter.git introduce TransmitUpdateEntry_Piece (nfc) Signed-off-by: Ian Jackson --- diff --git a/src/updates.rs b/src/updates.rs index ad96f5ab..6e6e884c 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -8,6 +8,7 @@ use crate::imports::*; type PUE = PreparedUpdateEntry; #[allow(non_camel_case_types)] type PUE_P = PreparedUpdateEntry_Piece; +#[allow(non_camel_case_types)] type TUE_P<'u> = TransmitUpdateEntry_Piece<'u>; // ---------- newtypes, type aliases, basic definitions ---------- @@ -117,10 +118,7 @@ enum TransmitUpdateEntry<'u> { zg: Option, svg: Option<&'u Html>, // IsResponseToClientOp::UpdateSvg }, - Piece { - piece: VisiblePieceId, - op: PieceUpdateOp<&'u PreparedPieceState, &'u ZLevel>, - }, + Piece(TransmitUpdateEntry_Piece<'u>), RecordedUnpredictable { piece: VisiblePieceId, cseq: ClientSequence, @@ -145,6 +143,13 @@ enum TransmitUpdateEntry<'u> { type TransmitUpdateLogEntry<'u> = (&'u Timezone, &'u CommittedLogEntry); +#[allow(non_camel_case_types)] +#[derive(Debug,Serialize)] +struct TransmitUpdateEntry_Piece<'u> { + piece: VisiblePieceId, + op: PieceUpdateOp<&'u PreparedPieceState, &'u ZLevel>, +} + #[derive(Debug,Serialize)] struct FormattedLogEntry<'u> { when: String, @@ -551,7 +556,7 @@ impl PreparedUpdate { let zg = op.new_z_generation(); TUE::Recorded { piece, cseq, zg, svg: ns.map(|ns| &ns.svg) } }, - FTG::Piece => TUE::Piece { piece, op: op.map_ref() }, + FTG::Piece => TUE::Piece(TUE_P { piece, op: op.map_ref() }), FTG::Exactly(x) => x, } } @@ -575,7 +580,7 @@ impl PreparedUpdate { TUE::Error(e) } else if let &ESVU::PieceOpError { piece, ref state, .. } = e { let op = PieceUpdateOp::Modify(state); - TUE::Piece { piece, op } + TUE::Piece(TUE_P { piece, op }) } else { continue }