Create a copy of a especified part of the data
(&self, start: usize, len: usize)
| 57 | |
| 58 | /// Create a copy of a especified part of the data |
| 59 | pub fn get_slice(&self, start: usize, len: usize) -> Option<Self> { |
| 60 | if start + len > self.len() { |
| 61 | return None; |
| 62 | } |
| 63 | let ptr = unsafe { BNGetDataBufferSlice(self.0, start, len) }; |
| 64 | (!ptr.is_null()).then(|| Self(ptr)) |
| 65 | } |
| 66 | |
| 67 | /// change the size of the allocated data, if new size is bigger data is |
| 68 | /// need to be initialized |