MCPcopy Index your code
hub / github.com/RustPython/RustPython / append_to

Method append_to

crates/vm/src/builtins/memory.rs:422–434  ·  view source on GitHub ↗
(&self, buf: &mut Vec<u8>)

Source from the content-addressed store, hash-verified

420 }
421
422 fn append_to(&self, buf: &mut Vec<u8>) {
423 if let Some(bytes) = self.as_contiguous() {
424 buf.extend_from_slice(&bytes);
425 } else {
426 buf.reserve(self.desc.len);
427 let bytes = &*self.buffer.obj_bytes();
428 self.desc.for_each_segment(true, |range| {
429 let start = (range.start + self.start as isize) as usize;
430 let end = (range.end + self.start as isize) as usize;
431 buf.extend_from_slice(&bytes[start..end]);
432 })
433 }
434 }
435
436 fn contiguous_or_collect<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R {
437 let borrowed;

Callers 3

contiguous_or_collectMethod · 0.45
to_contiguousMethod · 0.45
tobytesMethod · 0.45

Calls 4

for_each_segmentMethod · 0.80
as_contiguousMethod · 0.45
reserveMethod · 0.45
obj_bytesMethod · 0.45

Tested by

no test coverage detected