diff options
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/README.md | 2 | ||||
| -rw-r--r-- | rust/examples/simple.rs | 2 | ||||
| -rw-r--r-- | rust/src/symbol.rs | 8 |
3 files changed, 9 insertions, 3 deletions
diff --git a/rust/README.md b/rust/README.md index 1edd1d90..a18d46cd 100644 --- a/rust/README.md +++ b/rust/README.md @@ -34,7 +34,7 @@ fn main() { println!("Function count: {}", bv.functions().len()); for func in &bv.functions() { - println!("{}:", func.symbol().full_name()); + println!("{}: {}", func.start(), func.symbol()); } } ``` diff --git a/rust/examples/simple.rs b/rust/examples/simple.rs index c6065d48..f01d5267 100644 --- a/rust/examples/simple.rs +++ b/rust/examples/simple.rs @@ -17,7 +17,7 @@ fn main() { println!("Function count: {}", bv.functions().len()); for func in &bv.functions() { - println!("{:?}:", func.symbol().full_name()); + println!("{}:", func.symbol()); for basic_block in &func.basic_blocks() { // TODO : This is intended to be refactored to be more nice to work with soon(TM) for addr in basic_block.as_ref() { diff --git a/rust/src/symbol.rs b/rust/src/symbol.rs index 094aeba7..fac8cae5 100644 --- a/rust/src/symbol.rs +++ b/rust/src/symbol.rs @@ -15,7 +15,7 @@ //! Interfaces for the various kinds of symbols in a binary. use std::fmt; -use std::fmt::Debug; +use std::fmt::{Debug, Display, Formatter}; use std::hash::{Hash, Hasher}; use std::ptr; @@ -349,3 +349,9 @@ impl PartialEq for Symbol { self.handle == other.handle } } + +impl Display for Symbol { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str(&self.short_name().to_string_lossy()) + } +} |
