radareorg / r2pipe.rs

Rust crate for r2pipe
Other
45 stars 19 forks source link

Refactor the `R2pipe::threads` function to support binary paths which aren't `Vec<&'static str>` #50

Closed br0kej closed 1 year ago

br0kej commented 1 year ago

I'll preface with this saying I am fairly new to rust but....

Description

Whilst trying to create a CLI tool using r2pipe.rs to process a folder full of binaries of interest, I have been having some issues programmatically retrieving the file paths and getting them into &'static str types. From reading online, the only way of converting String types into &'static str is to essentially leak the String which isn't ideal! It may make the functions interface more ergonomic if it was refactored to something else such as AsRef<str>?

Please describe what are you missing or wanting to be improved

An ergonomic interface for R2pipe::threads

br0kej commented 1 year ago

I dug further into this and found out that the input object has to be 'static str' and there is no work around forstd::thread`. I fixed my ownership and closures and it works fine now :)