From e47fc9b689e6129c800797268f75640ae0941fd6 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 13 Jul 2021 18:33:06 +0100 Subject: [PATCH] errors: Make TUE::Error contain a bespoke TUE_P This will make space for a cseq there too. Signed-off-by: Ian Jackson --- src/updates.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/updates.rs b/src/updates.rs index 3c1cf29b..3ff0ad29 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -255,11 +255,20 @@ enum TransmitUpdateEntry<'u> { SetLinks(Html), #[serde(serialize_with="serialize_logentry")] Log(TransmitUpdateLogEntry<'u>), - Error(ErrorSignaledViaUpdate, &'u str>), + Error(ErrorSignaledViaUpdate, &'u str>), } type TransmitUpdateLogEntry<'u> = (&'u Timezone, &'u CommittedLogEntry); +#[allow(non_camel_case_types)] +#[derive(Debug,Serialize)] +struct ErrorTransmitUpdateEntry_Piece<'u> { + #[serde(flatten)] + tue: TransmitUpdateEntry_Piece<'u>, +} +#[allow(non_camel_case_types)] +type ETUE_P<'u> = ErrorTransmitUpdateEntry_Piece<'u>; + #[allow(non_camel_case_types)] #[derive(Debug,Serialize)] struct TransmitUpdateEntry_Piece<'u> { @@ -975,12 +984,17 @@ impl PreparedUpdate { ref error_msg, ref state } => { let c = state.by_client.as_ref().map(|(_,c,_)| *c); if c == None || c == Some(dest) { - let state = match pue_piece_to_tue_p(state, player) { + let tue = match pue_piece_to_tue_p(state, player) { Some(tue) => tue, None => continue, }; TUE::Error( - ESVU::PieceOpError { error, error_msg, partially, state } + ESVU::PieceOpError { + error, error_msg, partially, + state: { ETUE_P { + tue, + } }, + } ) } else { match partially { -- 2.30.2