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

Method read_byte

crates/stdlib/src/mmap.rs:1138–1149  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1136
1137 #[pymethod]
1138 fn read_byte(&self, vm: &VirtualMachine) -> PyResult<PyIntRef> {
1139 let pos = self.pos();
1140 if pos >= self.__len__() {
1141 return Err(vm.new_value_error("read byte out of range"));
1142 }
1143
1144 let b = self.check_valid(vm)?.deref().as_ref().unwrap().as_slice()[pos];
1145
1146 self.advance_pos(1);
1147
1148 Ok(PyInt::from(b).into_ref(&vm.ctx))
1149 }
1150
1151 #[pymethod]
1152 fn readline(&self, vm: &VirtualMachine) -> PyResult<PyBytesRef> {

Callers 2

test_io_methodsMethod · 0.45
test_non_ascii_byteMethod · 0.45

Calls 10

check_validMethod · 0.80
advance_posMethod · 0.80
ErrClass · 0.50
posMethod · 0.45
__len__Method · 0.45
as_sliceMethod · 0.45
unwrapMethod · 0.45
as_refMethod · 0.45
derefMethod · 0.45
into_refMethod · 0.45

Tested by 2

test_io_methodsMethod · 0.36
test_non_ascii_byteMethod · 0.36