MCPcopy Create free account
hub / github.com/RustCrypto/utils / zeroize_with_drop

Function zeroize_with_drop

zeroize_derive/src/lib.rs:474–507  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

472
473 #[test]
474 fn zeroize_with_drop() {
475 test_derive(
476 derive_zeroize_impl,
477 quote! {
478 #[zeroize(drop)]
479 struct Z {
480 a: String,
481 b: Vec<u8>,
482 c: [u8; 3],
483 }
484 },
485 quote! {
486 impl ::zeroize::Zeroize for Z {
487 fn zeroize(&mut self) {
488 match self {
489 #[allow(unused_variables, unused_assignments)]
490 Z { a, b, c } => {
491 a.zeroize();
492 b.zeroize();
493 c.zeroize()
494 }
495 _ => {}
496 }
497 }
498 }
499 #[doc(hidden)]
500 impl Drop for Z {
501 fn drop(&mut self) {
502 self.zeroize()
503 }
504 }
505 },
506 );
507 }
508
509 #[test]
510 fn zeroize_with_skip() {

Callers

nothing calls this directly

Calls 1

test_deriveFunction · 0.85

Tested by

no test coverage detected