How to escape curly braces in a format string in Rust
问题 I want to write this write!(f, "{ hash:{}, subject: {} }", self.hash, self.subject) But since curly braces have special meaning for formatting it's clear that I can't place the outer curly braces like that without escaping. So I tried to escape them. write!(f, "\{ hash:{}, subject: {} \}", self.hash, self.subject) Rust doesn't like that either. Then I read this: The literal characters {, }, or # may be included in a string by preceding them with the \ character. Since \ is already an escape