Skip to content

Commit e4c107c

Browse files
zeroize/derive: add docs for the Zeroize proc macro (#504)
1 parent cdbc6f8 commit e4c107c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

zeroize/derive/src/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ use quote::quote;
1414
use syn::{Attribute, Meta, NestedMeta};
1515
use synstructure::{decl_derive, BindStyle};
1616

17+
decl_derive!(
18+
[Zeroize, attributes(zeroize)] =>
19+
20+
/// Derive the `Zeroize` trait.
21+
///
22+
/// Supports the following attribute:
23+
///
24+
/// - `#[zeroize(drop)]`: derives the `Drop` trait, calling `zeroize()`
25+
/// when this item is dropped.
26+
derive_zeroize
27+
);
28+
1729
/// Name of zeroize-related attributes
1830
const ZEROIZE_ATTR: &str = "zeroize";
1931

@@ -30,8 +42,6 @@ fn derive_zeroize(s: synstructure::Structure<'_>) -> TokenStream {
3042
}
3143
}
3244

33-
decl_derive!([Zeroize, attributes(zeroize)] => derive_zeroize);
34-
3545
/// Custom derive attributes for `Zeroize`
3646
#[derive(Default)]
3747
struct ZeroizeAttrs {

0 commit comments

Comments
 (0)