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

Method restart_from

crates/vm/src/codecs.rs:636–650  ·  view source on GitHub ↗
(&mut self, pos: StrSize)

Source from the content-addressed store, hash-verified

634 }
635
636 fn restart_from(&mut self, pos: StrSize) -> Result<(), Self::Error> {
637 if pos.chars > self.data.char_len() {
638 return Err(self.vm.new_index_error(format!(
639 "position {} from error handler out of bounds",
640 pos.chars
641 )));
642 }
643 assert!(
644 self.data.as_wtf8().is_code_point_boundary(pos.bytes),
645 "invalid pos {pos:?} for {:?}",
646 self.data.as_wtf8()
647 );
648 self.pos = pos;
649 Ok(())
650 }
651
652 fn error_encoding(&self, range: Range<StrSize>, reason: Option<&str>) -> Self::Error {
653 let vm = self.vm;

Callers 3

handle_errorMethod · 0.80
handle_errorMethod · 0.80
encodeFunction · 0.80

Calls 3

ErrClass · 0.50
char_lenMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected