Переглянути джерело

feat: add must use to prepared structs (#1595)

tsk 1 місяць тому
батько
коміт
1d1874eba9

+ 1 - 0
crates/cdk/src/wallet/melt/mod.rs

@@ -121,6 +121,7 @@ impl MeltConfirmOptions {
 }
 
 /// A prepared melt operation that can be confirmed or cancelled.
+#[must_use = "must be confirmed or canceled to release reserved proofs"]
 pub struct PreparedMelt<'a> {
     /// The saga in the Prepared state
     saga: MeltSaga<'a, Prepared>,

+ 2 - 0
crates/cdk/src/wallet/multi_mint_wallet.rs

@@ -156,6 +156,7 @@ impl WalletConfig {
 ///
 /// This holds an `Arc<Wallet>` so it can call `.confirm()` without holding
 /// the RwLock. Created by [`MultiMintWallet::prepare_send`].
+#[must_use = "must be confirmed or canceled to release reserved proofs"]
 pub struct MultiMintPreparedSend {
     wallet: Arc<Wallet>,
     operation_id: Uuid,
@@ -254,6 +255,7 @@ impl std::fmt::Debug for MultiMintPreparedSend {
 ///
 /// This holds an `Arc<Wallet>` so it can call `.confirm()` without holding
 /// the RwLock. Created by [`MultiMintWallet::prepare_melt`].
+#[must_use = "must be confirmed or canceled to release reserved proofs"]
 pub struct MultiMintPreparedMelt {
     wallet: Arc<Wallet>,
     operation_id: Uuid,

+ 1 - 0
crates/cdk/src/wallet/send/mod.rs

@@ -24,6 +24,7 @@ use saga::SendSaga;
 ///
 /// Created by [`Wallet::prepare_send`]. Call [`confirm`](Self::confirm) to complete the send
 /// and create a token, or [`cancel`](Self::cancel) to release reserved proofs.
+#[must_use = "must be confirmed or canceled to release reserved proofs"]
 pub struct PreparedSend<'a> {
     wallet: &'a Wallet,
     operation_id: Uuid,