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

Method raw_seek

crates/vm/src/stdlib/_io.rs:942–952  ·  view source on GitHub ↗
(&mut self, pos: Offset, whence: i32, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

940 }
941
942 fn raw_seek(&mut self, pos: Offset, whence: i32, vm: &VirtualMachine) -> PyResult<Offset> {
943 let ret = vm.call_method(self.check_init(vm)?, "seek", (pos, whence))?;
944 let offset = get_offset(ret, vm)?;
945 if offset < 0 {
946 return Err(
947 vm.new_os_error(format!("Raw stream returned invalid position {offset}"))
948 );
949 }
950 self.abs_pos = offset;
951 Ok(offset)
952 }
953
954 fn seek(&mut self, target: Offset, whence: i32, vm: &VirtualMachine) -> PyResult<Offset> {
955 if matches!(whence, 0 | 1) && self.readable() {

Callers 4

flushMethod · 0.80
flush_rewindMethod · 0.80
seekMethod · 0.80
writeMethod · 0.80

Calls 5

get_offsetFunction · 0.85
check_initMethod · 0.80
new_os_errorMethod · 0.80
ErrClass · 0.50
call_methodMethod · 0.45

Tested by

no test coverage detected