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

Method get_pos

block-buffer/src/sealed.rs:39–47  ·  view source on GitHub ↗
(buf: &Block<N>, _pos: &Self::Pos)

Source from the content-addressed store, hash-verified

37 const NAME: &'static str = "BlockBuffer<Eager>";
38
39 fn get_pos<N: ArraySize>(buf: &Block<N>, _pos: &Self::Pos) -> usize {
40 // SAFETY: last byte in `buf` for eager hashes is always properly initialized
41 let pos = unsafe {
42 let buf_ptr = buf.as_ptr().cast::<u8>();
43 let last_byte_ptr = buf_ptr.add(N::USIZE - 1);
44 ptr::read(last_byte_ptr)
45 };
46 pos as usize
47 }
48
49 #[allow(clippy::cast_possible_truncation)]
50 fn set_pos<N: ArraySize>(buf: &mut Block<N>, _pos: &mut Self::Pos, val: usize) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected