Macro squish
macro_rules! squish {
($s:expr) => { ... };
}
Available on crate feature
dep_const_str
only.Expand description
Splits the string by ASCII whitespaces, and then joins the parts with a single space.
ยงExamples
use const_str::squish;
assert_eq!(squish!(" SQUISH \t THAT \t CAT! "), "SQUISH THAT CAT!");
const SQL: &str = squish!(
"SELECT
name,
created_at,
updated_at
FROM users
WHERE id = ?"
);
assert_eq!(SQL, "SELECT name, created_at, updated_at FROM users WHERE id = ?");