Skip to content

Commit 9c68ce3

Browse files
committed
[Rust] Add Display impl to Symbol
1 parent babf183 commit 9c68ce3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rust/src/symbol.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//! Interfaces for the various kinds of symbols in a binary.
1616
1717
use std::fmt;
18-
use std::fmt::Debug;
18+
use std::fmt::{Debug, Display};
1919
use std::hash::{Hash, Hasher};
2020
use std::ptr;
2121

@@ -302,6 +302,12 @@ impl Debug for Symbol {
302302
}
303303
}
304304

305+
impl Display for Symbol {
306+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
307+
write!(f, "{}", self.short_name().to_string_lossy())
308+
}
309+
}
310+
305311
impl ToOwned for Symbol {
306312
type Owned = Ref<Self>;
307313

0 commit comments

Comments
 (0)