Rollup merge of #103656 - camsteffen:symbol-to-string, r=compiler-errors
Specialize ToString for Symbol
This commit is contained in:
commit
f41b1bfd0f
1 changed files with 7 additions and 0 deletions
|
@ -1901,6 +1901,13 @@ impl fmt::Display for Symbol {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// takes advantage of `str::to_string` specialization
|
||||||
|
impl ToString for Symbol {
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
self.as_str().to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<S: Encoder> Encodable<S> for Symbol {
|
impl<S: Encoder> Encodable<S> for Symbol {
|
||||||
default fn encode(&self, s: &mut S) {
|
default fn encode(&self, s: &mut S) {
|
||||||
s.emit_str(self.as_str());
|
s.emit_str(self.as_str());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue