zeroize/derive: add docs for the `Zeroize` proc macro
@@ -14,6 +14,18 @@ use quote::quote;
use syn::{Attribute, Meta, NestedMeta};
use synstructure::{decl_derive, BindStyle};
+decl_derive!(
+ [Zeroize, attributes(zeroize)] =>
+
+ /// Derive the `Zeroize` trait.
+ ///
+ /// Supports the following attribute:
+ ///
+ /// - `#[zeroize(drop)]`: derives the `Drop` trait, calling `zeroize()`
+ /// when this item is dropped.
+ derive_zeroize
+);
+
/// Name of zeroize-related attributes
const ZEROIZE_ATTR: &str = "zeroize";
@@ -30,8 +42,6 @@ fn derive_zeroize(s: synstructure::Structure<'_>) -> TokenStream {
}
}
-decl_derive!([Zeroize, attributes(zeroize)] => derive_zeroize);
-
/// Custom derive attributes for `Zeroize`
#[derive(Default)]
struct ZeroizeAttrs {
