MCPcopy Create free account
hub / github.com/bjoernQ/bleps / read

Method read

bleps/src/attribute.rs:35–44  ·  view source on GitHub ↗
(&mut self, offset: usize, data: &mut [u8])

Source from the content-addressed store, hash-verified

33 }
34
35 fn read(&mut self, offset: usize, data: &mut [u8]) -> Result<usize, AttErrorCode> {
36 if offset > N {
37 return Ok(0);
38 }
39 let len = data.len().min(N - offset);
40 if len > 0 {
41 data[..len].copy_from_slice(&self[offset..offset + len]);
42 }
43 Ok(len)
44 }
45}
46
47impl<'a, const N: usize> AttData for &'a mut [u8; N] {

Callers 1

valueMethod · 0.45

Calls 2

into_resultMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected