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

Method truncate

crates/vm/src/stdlib/_io.rs:354–358  ·  view source on GitHub ↗
(&mut self, pos: Option<usize>)

Source from the content-addressed store, hash-verified

352 }
353
354 fn truncate(&mut self, pos: Option<usize>) -> usize {
355 let pos = pos.unwrap_or_else(|| self.tell() as usize);
356 self.cursor.get_mut().truncate(pos);
357 pos
358 }
359 }
360
361 fn check_closed(file: &PyObject, vm: &VirtualMachine) -> PyResult<()> {

Callers 15

slot_initMethod · 0.45
from_vectorcall_ownedMethod · 0.45
readlineMethod · 0.45
normpath_wideFunction · 0.45
readMethod · 0.45
read1Method · 0.45
extendleftMethod · 0.45
LCMapStringExFunction · 0.45
GetOverlappedResultMethod · 0.45
get_path_name_implFunction · 0.45
PeekNamedPipeFunction · 0.45
ReadFileFunction · 0.45

Calls 15

_unsupportedFunction · 0.85
flush_innerFunction · 0.85
io_closed_errorFunction · 0.85
get_offsetFunction · 0.85
lseekFunction · 0.85
get_mutMethod · 0.80
into_optionMethod · 0.80
try_usizeMethod · 0.80
try_resizableMethod · 0.80
get_fdMethod · 0.80
ftruncateFunction · 0.70
ErrClass · 0.50

Tested by

no test coverage detected