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

Function fill_slice

zeroize/src/bulk.rs:21–32  ·  view source on GitHub ↗
(dst: &mut [T], src: T)

Source from the content-addressed store, hash-verified

19/// Fill a slice using an assembly optimization barrier or portable volatile writes.
20#[inline]
21pub(crate) fn fill_slice<T: Copy>(dst: &mut [T], src: T) {
22 if size_of::<T>() == 0 {
23 return;
24 }
25
26 if HAS_ASM {
27 dst.fill(src);
28 optimization_barrier(dst);
29 } else {
30 volatile_fill_slice(dst, src);
31 }
32}
33
34/// Zero bytes which may be uninitialized, including padding.
35///

Callers 1

zeroizeMethod · 0.85

Calls 2

optimization_barrierFunction · 0.85
volatile_fill_sliceFunction · 0.85

Tested by

no test coverage detected