From 5b3b5ad946aa9ad024fe6d5a488885bcfa4eadfa Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 13 Jan 2021 21:58:45 +0000 Subject: [PATCH] Comment about alternatives we considered Signed-off-by: Ian Jackson --- src/accounts.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/accounts.rs b/src/accounts.rs index 641a231c..568e3ca6 100644 --- a/src/accounts.rs +++ b/src/accounts.rs @@ -322,8 +322,13 @@ impl AccountsGuard { if let Some(new_access) = set_access { if (|| Ok::<_,IE>( - rmp_serde::encode::to_vec(&new_access)? - != rmp_serde::encode::to_vec(&entry.access)? + // In lieu of downcasting. + // Ideally we would add Eq and PartialEq as a trait bound + // on PlayerAccessSpec and then use std::any::Any::downcast_ref + // in a provided method. Well, ideally this would not be + // necessary and we could do some magic. + rmp_serde::encode::to_vec(&new_access)? + != rmp_serde::encode::to_vec(&entry.access)? ))()? { process_all_players_for_account( games, -- 2.30.2