Skip to content

Commit

Permalink
chore: introduce non-deprecated version of primary module by instance…
Browse files Browse the repository at this point in the history
… id selection
  • Loading branch information
elsirion committed Dec 10, 2024
1 parent 81c82a4 commit 95c21ec
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion fedimint-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 95c21ec

Please sign in to comment.