pub fn with_timeout<F, R>(timeout: Duration, f: F) -> Result<R>where F: FnOnce() -> R + Send + 'static, R: Send + 'static,