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

Method push

crates/vm/src/stdlib/_io.rs:2524–2534  ·  view source on GitHub ↗
(&mut self, write: PendingWrite)

Source from the content-addressed store, hash-verified

2522
2523 impl PendingWrites {
2524 fn push(&mut self, write: PendingWrite) {
2525 self.num_bytes += write.as_bytes().len();
2526 self.data = match core::mem::take(&mut self.data) {
2527 PendingWritesData::None => PendingWritesData::One(write),
2528 PendingWritesData::One(write1) => PendingWritesData::Many(vec![write1, write]),
2529 PendingWritesData::Many(mut v) => {
2530 v.push(write);
2531 PendingWritesData::Many(v)
2532 }
2533 }
2534 }
2535 fn take(&mut self, vm: &VirtualMachine) -> PyBytesRef {
2536 let Self { num_bytes, data } = core::mem::take(self);
2537 if let PendingWritesData::One(PendingWrite::Bytes(b)) = data {

Callers 15

from_argsMethod · 0.45
extractMethod · 0.45
formatter_parserFunction · 0.45
py_newMethod · 0.45
callMethod · 0.45
getpwallFunction · 0.45
builtin_module_namesFunction · 0.45
spawnveFunction · 0.45
execveFunction · 0.45
listvolumesFunction · 0.45
listmountsFunction · 0.45
compute_abstract_methodsFunction · 0.45

Calls 4

takeFunction · 0.85
OneClass · 0.85
lenMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected