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

Method set_result

crates/stdlib/src/_asyncio.rs:266–277  ·  view source on GitHub ↗
(zelf: PyRef<Self>, result: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

264
265 #[pymethod]
266 fn set_result(zelf: PyRef<Self>, result: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
267 if zelf.fut_loop.read().is_none() {
268 return Err(vm.new_runtime_error("Future object is not initialized."));
269 }
270 if zelf.fut_state.load() != FutureState::Pending {
271 return Err(new_invalid_state_error(vm, "invalid state"));
272 }
273 *zelf.fut_result.write() = Some(result);
274 zelf.fut_state.store(FutureState::Finished);
275 Self::schedule_callbacks(&zelf, vm)?;
276 Ok(())
277 }
278
279 #[pymethod]
280 fn set_exception(

Callers

nothing calls this directly

Calls 8

new_invalid_state_errorFunction · 0.85
ErrClass · 0.50
SomeClass · 0.50
is_noneMethod · 0.45
readMethod · 0.45
loadMethod · 0.45
writeMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected