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

Method new

zeroize/tests/alloc.rs:42–48  ·  view source on GitHub ↗
(val: S)

Source from the content-addressed store, hash-verified

40
41impl<S: Zeroize> SecretBox<S> {
42 fn new(val: S) -> Self {
43 let mut b = Box::new(val);
44 // TODO(MSRV-1.98): use `Box::as_mut_ptr`
45 let p: *mut S = &raw mut *b;
46 REG_PTR.store(p.cast(), Relaxed);
47 Self(b)
48 }
49}
50
51impl<S: Zeroize> Drop for SecretBox<S> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected