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

Method new_view

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

this should be the only way to create a memoryview from another memoryview

(&self)

Source from the content-addressed store, hash-verified

119
120 /// this should be the only way to create a memoryview from another memoryview
121 pub fn new_view(&self) -> Self {
122 let zelf = Self {
123 buffer: self.buffer.clone(),
124 released: AtomicCell::new(false),
125 start: self.start,
126 format_spec: self.format_spec.clone(),
127 desc: self.desc.clone(),
128 hash: OnceCell::new(),
129 };
130 zelf.buffer.retain();
131 zelf
132 }
133
134 fn try_not_released(&self, vm: &VirtualMachine) -> PyResult<()> {
135 if self.released.load() {

Callers 4

from_objectMethod · 0.80
getitem_by_sliceMethod · 0.80
setitem_by_sliceMethod · 0.80
toreadonlyMethod · 0.80

Calls 3

newFunction · 0.85
cloneMethod · 0.45
retainMethod · 0.45

Tested by

no test coverage detected