Skip to main content

openapi_nexus/generators/rust/ureq/
runtime.rs

1//! Hardcoded Rust runtime source files for ureq (synchronous).
2
3use crate::codegen::traits::file_writer::FileInfo;
4use crate::generators::rust::common::project_files::with_header;
5
6const CLIENT_RS: &str = include_str!("runtime/client.rs.txt");
7const ERROR_RS: &str = include_str!("runtime/error.rs.txt");
8const AUTH_RS: &str = include_str!("runtime/auth.rs.txt");
9const MOD_RS: &str = include_str!("runtime/mod.rs.txt");
10
11/// Returns runtime files ready to write.
12pub fn runtime_files(header: &str) -> Vec<FileInfo> {
13    vec![
14        FileInfo::runtime("client.rs".to_string(), with_header(header, CLIENT_RS)),
15        FileInfo::runtime("error.rs".to_string(), with_header(header, ERROR_RS)),
16        FileInfo::runtime("auth.rs".to_string(), with_header(header, AUTH_RS)),
17        FileInfo::runtime("mod.rs".to_string(), with_header(header, MOD_RS)),
18    ]
19}