2个版本 (1个稳定版)
1.0.0 | 2024年6月3日 |
---|---|
0.1.0 | 2024年5月14日 |
#703 in 文本处理
每月71次下载
20KB
375 行
merge_whitespace
此crate包含用于从给定的字符串字面量中删除多个连续空格的过程宏,并用单个空格替换。
示例
以下示例使用可选引号字符来保持引号文本范围不被合并,以及可选转义字符以确保引号字符字面量保持原样。
use merge_whitespace::merge_whitespace;
const QUERY: &str = merge_whitespace!(r#"
query {
users (limit: 1, filter: "bought a 12\" vinyl
named \"spaces in space \"") {
id
name
todos(order_by: {created_at: desc}, limit: 5) {
id
title
}
}
}
"#,
quote_char = '"',
escape_char = '\\');
#[test]
fn test() {
assert_eq!(QUERY, r#"query { users (limit: 1, filter: "bought a 12\" vinyl
named \"spaces in space \"") { id name todos(order_by: {created_at: desc}, limit: 5) { id title } } }"#);
}
依赖项
~275–730KB
~17K SLoC