Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
stri
stri is a set of procedural macros for string interpolation.
Usage Example
use ;
file! macro
For longer string or sql content, you can externalize it into a separate file and use the file! macro to include it. The file! macro intelligently applies the logic of the si! or sql! macros internally, determined by the extension of the specified file.
Example
File: src/example.txt
my name is {name}, i am {age} years old and my height is {height}
File: src/example.sql
INSERT INTO users (name, age, height, note) VALUES ({name}, {age}, {height}, {note})
use file;
dir! macro
The dir! macro allows you to concatenate the content of multiple files within a specified directory. It reads all files only at the first level of the given directory, joins their content with a newline character (\n), and intelligently processes them based on the file extensions within the directory:
-
If all files have the .sql extension:
sql!macro's logic will be applied. -
Otherwise:
si!macro's logic will be applied.
Note: The order in which files are read and concatenated is dependent on the the behavior of std::fs::ReadDir.
Example
Dir: src
src/ ├── sql │ ├── 1_insert.sql │ └── 2_delete.sql ├── txt │ ├── 1_name.txt │ └── 2_age.txt └── main.rs
File: src/sql/1_insert.sql
INSERT INTO users (name, age, height, note) VALUES ({name}, {age}, {height}, {note});
File: src/sql/2_insert.sql
DELETE FROM users WHERE name={name};
File: src/txt/1_name.txt
My name is {name}
File: src/txt/2_age.txt
I am {age} years old
File src/main.rs
use dir;
Contribution
If you encounter any issues or want to suggest a feature, please open an issue in github.
License Information
"stri" is licensed under Ethical Use License (EUL v1.0). see LICENSE for full license details.