in api_generator/src/generator/code_gen/request/request_builder.rs [366:400]
fn create_request_timeout_fn(field: &syn::Ident) -> syn::ImplItem {
let doc_attr = doc("Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished.");
syn::ImplItem {
ident: ident("request_timeout"),
vis: syn::Visibility::Public,
defaultness: syn::Defaultness::Final,
attrs: vec![doc_attr],
node: syn::ImplItemKind::Method(
syn::MethodSig {
unsafety: syn::Unsafety::Normal,
constness: syn::Constness::NotConst,
abi: None,
decl: syn::FnDecl {
inputs: vec![
syn::FnArg::SelfValue(syn::Mutability::Mutable),
syn::FnArg::Captured(
syn::Pat::Path(None, path_none("timeout")),
syn::parse_type("Duration").unwrap(),
),
],
output: syn::FunctionRetTy::Ty(code_gen::ty("Self")),
variadic: false,
},
generics: generics_none(),
},
syn::Block {
stmts: vec![
syn::Stmt::Semi(Box::new(parse_expr(quote!(self.#field = Some(timeout))))),
syn::Stmt::Expr(Box::new(parse_expr(quote!(self)))),
],
},
),
}
}