Skip to content

Commit

Permalink
doc: trd: store perms: update impl type
Browse files Browse the repository at this point in the history
Needs a wrapper struct to enforce capabilities in the constructor.
  • Loading branch information
bradjc committed Jul 3, 2024
1 parent 48e7cca commit 6d41195
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions doc/reference/trd-storage-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ The `StoragePermissions` type is capable of holding storage permissions in
different formats. In general, the type looks like:

```rust
pub enum StoragePermissions {
pub struct StoragePermissions(StoragePermissionsPrivate);

enum StoragePermissionsPrivate {
SelfOnly(core::num::NonZeroU32),
FixedSize(FixedSizePermissions),
Listed(ListedPermissions),
Expand All @@ -261,8 +263,10 @@ Each variant is a different method for representing and storing storage
permissions. For example, `FixedSize` contains fixed size lists of permissions,
where as `Null` grants no storage permissions.

The `StoragePermissions` type includes multiple constructors for instantiating
storage permissions.
The `StoragePermissions` struct includes multiple constructors for instantiating
storage permissions. The struct wraps the enum to ensure that permissions can
only be created with those constructors. The constructors require a capability
to use so only trusted code can create storage permissions.


7 Specifying Permissions
Expand Down

0 comments on commit 6d41195

Please sign in to comment.