pub fn with_timeout<F>(
f: F,
timeout: Duration,
ctx: &Context,
prefix: &str,
) -> Result<CompletionResult>Expand description
Wraps a completion function with a timeout
This function ensures that completion operations don’t hang indefinitely by imposing a timeout. If the operation doesn’t complete within the timeout, it returns a partial result with a help message indicating the timeout.
§Arguments
f- The completion function to wraptimeout- Maximum duration to wait for completionctx- The context for the completionprefix- The prefix being completed
§Returns
Returns the completion result if it completes within the timeout, or a partial result with timeout information if it exceeds the timeout.