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

Function DeleteKey

crates/vm/src/stdlib/winreg.rs:372–380  ·  view source on GitHub ↗
(key: PyRef<PyHkey>, sub_key: String, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

370
371 #[pyfunction]
372 fn DeleteKey(key: PyRef<PyHkey>, sub_key: String, vm: &VirtualMachine) -> PyResult<()> {
373 let wide_sub_key = sub_key.to_wide_with_nul();
374 let res = unsafe { Registry::RegDeleteKeyW(key.hkey.load(), wide_sub_key.as_ptr()) };
375 if res == 0 {
376 Ok(())
377 } else {
378 Err(vm.new_os_error(format!("error code: {res}")))
379 }
380 }
381
382 #[pyfunction]
383 fn DeleteValue(key: PyRef<PyHkey>, value: Option<String>, vm: &VirtualMachine) -> PyResult<()> {

Calls 5

to_wide_with_nulMethod · 0.80
new_os_errorMethod · 0.80
ErrClass · 0.50
loadMethod · 0.45
as_ptrMethod · 0.45