openapi_nexus/generators/rust/reqwest/
runtime.rs1use crate::codegen::traits::file_writer::FileInfo;
7
8const CLIENT_RS: &str = include_str!("runtime/client.rs.txt");
9const ERROR_RS: &str = include_str!("runtime/error.rs.txt");
10const AUTH_RS: &str = include_str!("runtime/auth.rs.txt");
11const MOD_RS: &str = include_str!("runtime/mod.rs.txt");
12
13pub fn runtime_files(header: &str) -> Vec<FileInfo> {
15 vec![
16 FileInfo::runtime("client.rs".to_string(), with_header(header, CLIENT_RS)),
17 FileInfo::runtime("error.rs".to_string(), with_header(header, ERROR_RS)),
18 FileInfo::runtime("auth.rs".to_string(), with_header(header, AUTH_RS)),
19 FileInfo::runtime("mod.rs".to_string(), with_header(header, MOD_RS)),
20 ]
21}
22
23fn with_header(header: &str, body: &str) -> String {
24 let mut out = String::with_capacity(header.len() + body.len());
25 out.push_str(header);
26 out.push_str(body);
27 out
28}