From: Ian Jackson Date: Wed, 13 Jan 2021 21:58:45 +0000 (+0000) Subject: Comment about alternatives we considered X-Git-Tag: otter-0.3.0~26 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5b3b5ad946aa9ad024fe6d5a488885bcfa4eadfa;p=otter.git Comment about alternatives we considered Signed-off-by: Ian Jackson --- 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,