String 如何在不向原始字符串中插入换行符的情况下包装原始字符串文字?

String 如何在不向原始字符串中插入换行符的情况下包装原始字符串文字?,string,rust,literals,String,Rust,Literals,我有一个非常长的原始字符串文本。是否可以在不向字符串添加换行符的情况下将其拆分为多行 file.write(r#"This is an example of a line which is well over 100 characters in length. Id like to know if its possible to wrap it! Now some characters to justify using a raw string \foo\bar\baz :)"#) 例如,在P

我有一个非常长的原始字符串文本。是否可以在不向字符串添加换行符的情况下将其拆分为多行

file.write(r#"This is an example of a line which is well over 100 characters in length. Id like to know if its possible to wrap it! Now some characters to justify using a raw string \foo\bar\baz :)"#)
例如,在Python和C中,您可以简单地将其编写为多个字符串文本

# "some string"
(r"some "
 r"string")

是否可以在Rust中执行类似操作?

虽然原始字符串文字不支持此操作,但可以使用以下方法实现:

let a = concat!(
    r#"some very "#,
    r#"long string "#,
    r#"split over lines"#);

let b = r#"some very long string split over lines"#;
assert_eq!(a, b);