From 95c21ec499c0f63bb26b0726a169b95a93d2fa3e Mon Sep 17 00:00:00 2001 From: elsirion Date: Mon, 9 Dec 2024 22:10:27 +0100 Subject: [PATCH] chore: introduce non-deprecated version of primary module by instance id selection --- fedimint-client/src/lib.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/fedimint-client/src/lib.rs b/fedimint-client/src/lib.rs index 86eb1ce5a07..c246cd05f5e 100644 --- a/fedimint-client/src/lib.rs +++ b/fedimint-client/src/lib.rs @@ -2363,9 +2363,26 @@ impl ClientBuilder { /// If there was a primary module specified previously #[deprecated( since = "0.6.0", - note = "Use `with_primary_module_kind` instead, as the instance id can't be known upfront" + note = "Use `with_primary_module_kind` instead, as the instance id can't be known upfront. If you *really* need the old behavior you can use `with_primary_module_instance_id`." )] pub fn with_primary_module(&mut self, primary_module_instance: ModuleInstanceId) { + self.with_primary_module_instance_id(primary_module_instance); + } + + /// **You are likely looking for + /// [`ClientBuilder::with_primary_module_kind`]. This function is rarely + /// useful and often dangerous, handle with care.** + /// + /// Uses this module with the given instance id as the primary module. See + /// [`ClientModule::supports_being_primary`] for more information. Since the + /// module instance id of modules of a specific kind may differ between + /// different federations it is generally not recommended to specify it, but + /// rather to specify the module kind that should be used as primary. See + /// [`ClientBuilder::with_primary_module_kind`]. + /// + /// ## Panics + /// If there was a primary module specified previously + pub fn with_primary_module_instance_id(&mut self, primary_module_instance: ModuleInstanceId) { let was_replaced = self .primary_module_instance .replace(primary_module_instance)