MCPcopy Create free account
hub / github.com/evilsocket/cake / read_bytes

Method read_bytes

cake-core/src/utils/tensor_storage.rs:208–219  ·  view source on GitHub ↗
(&self, offset: u64, size: usize)

Source from the content-addressed store, hash-verified

206 #[cfg(unix)]
207 #[inline]
208 fn read_bytes(&self, offset: u64, size: usize) -> Vec<u8> {
209 let mut buf = Vec::with_capacity(size);
210 unsafe {
211 std::ptr::copy_nonoverlapping(
212 self.mmap_ptr.add(offset as usize),
213 buf.as_mut_ptr(),
214 size,
215 );
216 buf.set_len(size);
217 }
218 buf
219 }
220
221 /// Get a zero-copy slice into the mmap'd region.
222 #[cfg(unix)]

Callers 3

read_tensorMethod · 0.80
read_tensorsMethod · 0.80
read_tensor_sliceMethod · 0.80

Calls 1

as_mut_ptrMethod · 0.80

Tested by

no test coverage detected