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

Function use_tool_id

crates/vm/src/stdlib/sys/monitoring.rs:540–548  ·  view source on GitHub ↗
(tool_id: i32, name: &str, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

538}
539
540fn use_tool_id(tool_id: i32, name: &str, vm: &VirtualMachine) -> PyResult<()> {
541 let tool = check_valid_tool(tool_id, vm)?;
542 let mut state = vm.state.monitoring.lock();
543 if state.tool_names[tool].is_some() {
544 return Err(vm.new_value_error(format!("tool {tool_id} is already in use")));
545 }
546 state.tool_names[tool] = Some(name.to_owned());
547 Ok(())
548}
549
550fn clear_tool_id(tool_id: i32, vm: &VirtualMachine) -> PyResult<()> {
551 let tool = check_valid_tool(tool_id, vm)?;

Callers

nothing calls this directly

Calls 6

check_valid_toolFunction · 0.85
ErrClass · 0.50
SomeClass · 0.50
lockMethod · 0.45
to_ownedMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected