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

Method _callbacks

crates/stdlib/src/_asyncio.rs:613–638  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

611
612 #[pygetset]
613 fn _callbacks(&self, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
614 let mut result = Vec::new();
615
616 if let Some(cb0) = self.fut_callback0.read().clone() {
617 let ctx0 = self
618 .fut_context0
619 .read()
620 .clone()
621 .unwrap_or_else(|| vm.ctx.none());
622 result.push(vm.ctx.new_tuple(vec![cb0, ctx0]).into());
623 }
624
625 if let Some(callbacks) = self.fut_callbacks.read().clone() {
626 let list: PyListRef = callbacks.downcast().unwrap();
627 for item in list.borrow_vec().iter() {
628 result.push(item.clone());
629 }
630 }
631
632 // Return None if no callbacks
633 if result.is_empty() {
634 Ok(vm.ctx.none())
635 } else {
636 Ok(vm.ctx.new_list(result).into())
637 }
638 }
639
640 #[pygetset]
641 fn _result(&self, vm: &VirtualMachine) -> PyObjectRef {

Callers

nothing calls this directly

Calls 12

newFunction · 0.85
noneMethod · 0.80
downcastMethod · 0.80
borrow_vecMethod · 0.80
new_listMethod · 0.80
cloneMethod · 0.45
readMethod · 0.45
pushMethod · 0.45
new_tupleMethod · 0.45
unwrapMethod · 0.45
iterMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected