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

Method suboffsets

crates/vm/src/builtins/memory.rs:617–635  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

615
616 #[pygetset]
617 fn suboffsets(&self, vm: &VirtualMachine) -> PyResult<PyTupleRef> {
618 self.try_not_released(vm)?;
619 let has_suboffsets = self
620 .desc
621 .dim_desc
622 .iter()
623 .any(|(_, _, suboffset)| *suboffset != 0);
624 if has_suboffsets {
625 Ok(vm.ctx.new_tuple(
626 self.desc
627 .dim_desc
628 .iter()
629 .map(|(_, _, suboffset)| suboffset.to_pyobject(vm))
630 .collect(),
631 ))
632 } else {
633 Ok(vm.ctx.empty_tuple.clone())
634 }
635 }
636
637 #[pygetset]
638 fn format(&self, vm: &VirtualMachine) -> PyResult<PyStr> {

Callers

nothing calls this directly

Calls 7

try_not_releasedMethod · 0.80
collectMethod · 0.80
iterMethod · 0.45
new_tupleMethod · 0.45
mapMethod · 0.45
to_pyobjectMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected