diff options
| author | Mason Reed <mason@vector35.com> | 2025-05-07 19:22:21 -0400 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2025-05-12 17:45:24 -0400 |
| commit | 2f214f6c9935e8ce8df4732cde44a540a003258c (patch) | |
| tree | 6fe319433ef0d2ad75fcc58a50eaa632bb627ec9 /rust/examples | |
| parent | b4cf0be8816182c9efca037e27e9439482f8bf36 (diff) | |
[Rust] Reduce usage of `IntoCStr` in function signatures
This is being done to reduce complexity in function signatures, specifically many of the strings we are passing ultimately should be new types themselves instead of "just strings", things such as type ids.
Another place which was confusing was dealing with filesystem related APIs, this commit turns most of those params into a stricter `Path` type.
This is bringing the rust api more inline with both python and C++, where the wrapper eagerly converts the string into the languages standard string type.
Special consideration must be made for symbols or other possible non utf-8 objects.
This commit will be followed up with one that adds the `IntoCStr` bound on API's we want to keep as invalid utf-8 so we can for example, get section by name on a section with invalid utf-8.
Diffstat (limited to 'rust/examples')
| -rw-r--r-- | rust/examples/high_level_il.rs | 2 | ||||
| -rw-r--r-- | rust/examples/medium_level_il.rs | 2 | ||||
| -rw-r--r-- | rust/examples/simple.rs | 2 | ||||
| -rw-r--r-- | rust/examples/type_printer.rs | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/rust/examples/high_level_il.rs b/rust/examples/high_level_il.rs index d57509da..ddc8f08d 100644 --- a/rust/examples/high_level_il.rs +++ b/rust/examples/high_level_il.rs @@ -16,7 +16,7 @@ fn main() { println!("Function count: {}", bv.functions().len()); for func in &bv.functions() { - println!("{}:", func.symbol().full_name()); + println!("{:?}:", func.symbol().full_name()); let Ok(il) = func.high_level_il(true) else { continue; diff --git a/rust/examples/medium_level_il.rs b/rust/examples/medium_level_il.rs index 61c3a330..543a0856 100644 --- a/rust/examples/medium_level_il.rs +++ b/rust/examples/medium_level_il.rs @@ -16,7 +16,7 @@ fn main() { println!("Function count: {}", bv.functions().len()); for func in &bv.functions() { - println!("{}:", func.symbol().full_name()); + println!("{:?}:", func.symbol().full_name()); let Ok(il) = func.medium_level_il() else { continue; diff --git a/rust/examples/simple.rs b/rust/examples/simple.rs index f41cbf34..c6065d48 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().full_name()); 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/examples/type_printer.rs b/rust/examples/type_printer.rs index ea9c6a4d..846e1a09 100644 --- a/rust/examples/type_printer.rs +++ b/rust/examples/type_printer.rs @@ -35,5 +35,5 @@ fn main() { TokenEscapingType::NoTokenEscapingType, ); - println!("{}", printed_types.unwrap()); + println!("{:?}", printed_types.unwrap()); } |
