File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -308,6 +308,13 @@ For integral types, this has no meaning currently.
308
308
For floating-point types, this indicates how many digits after the decimal point
309
309
should be printed.
310
310
311
+ ## Escaping
312
+
313
+ The literal characters `{`, `}`, or `#` may be included in a string by
314
+ preceding them with the `\` character. Since `\` is already an
315
+ escape character in Rust strings, a string literal using this escape
316
+ will look like `"\\{"`.
317
+
311
318
*/
312
319
313
320
use prelude:: * ;
Original file line number Diff line number Diff line change @@ -213,6 +213,12 @@ pub fn main() {
213
213
t!( format!( "{:+10.3f}" , 1.0 f) , " +1.000" ) ;
214
214
t!( format!( "{:+10.3f}" , -1.0 f) , " -1.000" ) ;
215
215
216
+ // Escaping
217
+ t!( format!( "\\ {" ) , "{" ) ;
218
+ t!( format!( "\\ }" ) , "}" ) ;
219
+ t!( format!( "\\ #" ) , "#" ) ;
220
+ t!( format!( "\\ \\ " ) , "\\ " ) ;
221
+
216
222
test_write( ) ;
217
223
test_print( ) ;
218
224
You can’t perform that action at this time.
0 commit comments