MCPcopy Create free account
hub / github.com/apache/arrow-rs / advance

Method advance

arrow-buffer/src/buffer/immutable.rs:264–277  ·  view source on GitHub ↗
(&mut self, offset: usize)

Source from the content-addressed store, hash-verified

262 /// Panics iff `offset` is larger than `len`.
263 #[inline]
264 pub fn advance(&mut self, offset: usize) {
265 assert!(
266 offset <= self.length,
267 "the offset of the new Buffer cannot exceed the existing length: offset={} length={}",
268 offset,
269 self.length
270 );
271 self.length -= offset;
272 // Safety:
273 // This cannot overflow as
274 // `self.offset + self.length < self.data.len()`
275 // `offset < self.length`
276 self.ptr = unsafe { self.ptr.add(offset) };
277 }
278
279 /// Returns a new [Buffer] that is a slice of this buffer starting at `offset`,
280 /// with `length` bytes.

Callers 1

sliceMethod · 0.45

Calls 1

addMethod · 0.45

Tested by

no test coverage detected