Skip to main content

sql

Macro sql 

Source
macro_rules! sql {
    ($name:literal) => { ... };
}
Expand description

The statement text of sql/<name>.sql, checked in at compile time.

The path is built from CARGO_MANIFEST_DIR, which the compiler reads while it compiles the crate that invokes the macro, so each crate loads from the sql/ directory beside its own Cargo.toml, never from this crate’s.

The trailing newline every text file carries is trimmed, in a const block so it costs nothing at run time and the result stays a &'static str. A statement that used to be a Rust literal ended at its last word, and callers and tests anchored on that: leaving the newline on would change the string a reader of this file has no reason to think changed.