1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#![crate_name = "zeroize"]
#![crate_type = "rlib"]
#![no_std]
#![deny(
warnings,
missing_docs,
unused_import_braces,
unused_qualifications,
)]
#![doc(html_root_url = "https://docs.rs/zeroize/0.1.0")]
#[cfg(any(feature = "std", test))]
#[macro_use]
extern crate std;
#[cfg(feature = "nightly")]
mod nightly;
#[cfg(feature = "nightly")]
pub use nightly::secure_zero_memory;
#[cfg(not(feature = "nightly"))]
mod stable;
#[cfg(not(feature = "nightly"))]
pub use stable::secure_zero_memory;
#[cfg(test)]
mod tests {
use super::secure_zero_memory;
use std::prelude::v1::*;
#[test]
fn test_secure_zero_memory() {
let mut buffer = Vec::from("DEADBEEFCAFE");
secure_zero_memory(&mut buffer);
assert_eq!(buffer, [0u8; 12]);
}
}