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

Function get_offset

crates/vm/src/stdlib/_io.rs:1534–1542  ·  view source on GitHub ↗
(obj: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1532 }
1533
1534 pub fn get_offset(obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<Offset> {
1535 let int = obj.try_index(vm)?;
1536 int.as_bigint().try_into().map_err(|_| {
1537 vm.new_value_error(format!(
1538 "cannot fit '{}' into an offset-sized integer",
1539 obj.class().name()
1540 ))
1541 })
1542 }
1543
1544 pub fn repr_file_obj_name(obj: &PyObject, vm: &VirtualMachine) -> PyResult<Option<PyStrRef>> {
1545 let name = match obj.get_attr("name", vm) {

Callers 5

raw_seekMethod · 0.85
raw_tellMethod · 0.85
seekMethod · 0.85
seekMethod · 0.85
truncateMethod · 0.85

Calls 2

try_indexMethod · 0.80
as_bigintMethod · 0.80

Tested by

no test coverage detected