1#![doc(
2 html_logo_url = "https://github.com/cloudwego/volo/raw/main/.github/assets/logo.png?sanitize=true"
3)]
4#![cfg_attr(not(doctest), doc = include_str!("../README.md"))]
5#![allow(clippy::mutable_key_type)]
6#[macro_use]
7mod command;
8pub mod context;
9mod http;
10mod idl;
11mod init;
12mod migrate;
13pub mod model;
14mod repo;
15
16#[macro_export]
19macro_rules! templates_to_target_file {
20 ($folder: ident, $template_file_name: expr, $target_file_name: expr) => {
21 let folder = $folder;
22 let file_path = folder.join($target_file_name);
23 if !file_path.exists() {
24 let content = include_bytes!($template_file_name);
25 let mut file = std::fs::File::create(file_path)?;
26 std::io::Write::write_all(&mut file, content)?;
27 }
28 };
29
30 ($folder: ident, $template_file_name: expr, $target_file_name: expr, $($args:tt)*) => {
31 let folder = $folder;
32 let file_path = folder.join($target_file_name);
33 if !file_path.exists() {
34 let content = format!(include_str!($template_file_name), $($args)*);
35 let mut file = std::fs::File::create(file_path)?;
36 std::io::Write::write_all(&mut file, content.as_bytes())?;
37 }
38 };
39}