4 releases (1 stable)

1.0.0 Oct 18, 2022
0.3.1 Jun 3, 2022
0.3.0 Jun 1, 2022
0.2.0 Apr 21, 2021

#2069 in Procedural macros

Download history 2224/week @ 2024-07-23 3251/week @ 2024-07-30 4123/week @ 2024-08-06 3839/week @ 2024-08-13 2957/week @ 2024-08-20 3128/week @ 2024-08-27 2925/week @ 2024-09-03 1602/week @ 2024-09-10 1646/week @ 2024-09-17 2399/week @ 2024-09-24 1774/week @ 2024-10-01 1979/week @ 2024-10-08 2400/week @ 2024-10-15 2039/week @ 2024-10-22 1504/week @ 2024-10-29 1730/week @ 2024-11-05

8,219 downloads per month
Used in 13 crates (3 directly)

Apache-2.0

8KB
127 lines

Derive

This crate contains procedural macros for Stronghold.

GuardDebug

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.

Example:
#[derive(GuardDebug)]
struct Foo {
    some_data: String
}
...

let foo = Foo { some_data: "Some data"};

println!("{:?}", foo);
...

> Foo(guarded)

RequestPermissions

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...


lib.rs:

Proc macros for Stronghold.

Dependencies

~1.5MB
~37K SLoC