pub struct TimeoutConfig {
pub total: Option<Duration>,
pub first_response: Option<Duration>,
}Expand description
Configuration for operation timeouts
Fields§
§total: Option<Duration>Overall timeout for the entire operation
first_response: Option<Duration>Timeout for first response (useful for streaming)
Implementations§
Source§impl TimeoutConfig
impl TimeoutConfig
Sourcepub async fn execute<F, T>(
&self,
operation_name: &str,
operation: F,
) -> Result<T, RuntimeError>
pub async fn execute<F, T>( &self, operation_name: &str, operation: F, ) -> Result<T, RuntimeError>
Execute an async operation with timeout protection
§Example
use agent_runtime::timeout::TimeoutConfig;
use std::time::Duration;
let config = TimeoutConfig::default();
let result = config.execute(
"fetch_data",
async {
// Your operation here
Ok("success".to_string())
}
).await?;Sourcepub async fn execute_with_first_response<F, T>(
&self,
operation_name: &str,
operation: F,
) -> Result<T, RuntimeError>
pub async fn execute_with_first_response<F, T>( &self, operation_name: &str, operation: F, ) -> Result<T, RuntimeError>
Execute with first response timeout (useful for streaming)
Returns a tuple of (first_chunk, remaining_stream)
Trait Implementations§
Source§impl Clone for TimeoutConfig
impl Clone for TimeoutConfig
Source§fn clone(&self) -> TimeoutConfig
fn clone(&self) -> TimeoutConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TimeoutConfig
impl Debug for TimeoutConfig
Auto Trait Implementations§
impl Freeze for TimeoutConfig
impl RefUnwindSafe for TimeoutConfig
impl Send for TimeoutConfig
impl Sync for TimeoutConfig
impl Unpin for TimeoutConfig
impl UnwindSafe for TimeoutConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more