Skip to main content

cached_call

Function cached_call 

Source
pub fn cached_call<V, F>(
    cache: &mut ToolCache<V>,
    tool_name: &str,
    args: &Value,
    compute: F,
) -> V
where V: Clone, F: FnOnce() -> V,
Expand description

Convenience: look up (tool_name, args) in cache or compute and store compute(). Returns an owned clone of the cached value.

This is the Rust equivalent of the Python cache.wrap(...) decorator; since Rust does not decorate functions, callers wrap a call site instead.