Crates.io | stronghold-derive |
lib.rs | stronghold-derive |
version | 1.0.0 |
source | src |
created_at | 2021-04-21 21:35:26.202906 |
updated_at | 2022-10-18 16:13:33.998896 |
description | Proc macros and derives for Stronghold |
homepage | https://stronghold.docs.iota.org |
repository | https://github.com/iotaledger/stronghold.rs |
max_upload_size | |
id | 387871 |
size | 15,452 |
This crate contains procedural macros for Stronghold.
The GuardDebug macro is used to block inspection of a data structure. It implements the Debug trait and explicitly blocks the reading of the internal data on the structure its derived on. Instead, the data will be returned out as a (guarded)
string.
#[derive(GuardDebug)]
struct Foo {
some_data: String
}
...
let foo = Foo { some_data: "Some data"};
println!("{:?}", foo);
...
> Foo(guarded)
Implements the VariantPermission
for struct/unions with PermissionValue(1). For enums, it implements ToPermissionVariants
, which creates an according new enum <Ident>Permission
with Unit variants, and implements VariantPermission
by assigning different PermissionValue
for each variant. The permission value is the "index" in the enum as exponent for the power of 2, thus from top to bottom 1, 2, 4, 8...