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

Method from_buffer_range

crates/vm/src/builtins/memory.rs:108–118  ·  view source on GitHub ↗

don't use this function to create the memoryview if the buffer is exporting via another memoryview, use PyMemoryView::new_view() or PyMemoryView::from_object to reduce the chain

(
        buffer: PyBuffer,
        range: Range<usize>,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

106 /// via another memoryview, use PyMemoryView::new_view() or PyMemoryView::from_object
107 /// to reduce the chain
108 pub fn from_buffer_range(
109 buffer: PyBuffer,
110 range: Range<usize>,
111 vm: &VirtualMachine,
112 ) -> PyResult<Self> {
113 let mut zelf = Self::from_buffer(buffer, vm)?;
114
115 zelf.init_range(range, 0);
116 zelf.init_len();
117 Ok(zelf)
118 }
119
120 /// this should be the only way to create a memoryview from another memoryview
121 pub fn new_view(&self) -> Self {

Callers

nothing calls this directly

Calls 2

init_rangeMethod · 0.80
init_lenMethod · 0.80

Tested by

no test coverage detected