Skip to content

Commit

Permalink
Introduce mutation policy, make guard more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
dastansam committed Apr 29, 2024
1 parent ddf1711 commit d1e0384
Show file tree
Hide file tree
Showing 3 changed files with 286 additions and 185 deletions.
12 changes: 6 additions & 6 deletions prdoc/pr_4204.prdoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ doc:
and also for recording the state difference for testing, debugging, and other purposes.

Example:

```rust
let _guard = StateDiffGuardBuilder::default()
.must_change(StoragePrefix{
pallet_name: b"Balances",
storage_name: b"TotalIssuance",
})
.build();
let _guard = StateDiffGuard::builder()
.must_change(GuardSubject::Prefix(SomeMap::<T>::storage_info().first().unwrap().clone()))
.must_not_change(GuardSubject::Prefix(SomeDoubleMap::<T>::storage_info().first().unwrap().clone()))
.can_not_change(GuardSubject::AnythingElse)
.build();

// do something that may change the storage

Expand Down
Loading

0 comments on commit d1e0384

Please sign in to comment.