diff options
| author | rbran <git@rubens.io> | 2025-04-23 19:24:45 +0000 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2025-05-12 17:45:24 -0400 |
| commit | c2d90f2e5a010546d0e1f1deeb1a6d8531ea4d4f (patch) | |
| tree | 20a6c6268943154fdda6a4d6884f2f29d9d4de50 /rust/src/string.rs | |
| parent | 4a4a8488269922269b20a12a7b71272b925b9f18 (diff) | |
[Rust] Implement custom interactive handler
Diffstat (limited to 'rust/src/string.rs')
| -rw-r--r-- | rust/src/string.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/rust/src/string.rs b/rust/src/string.rs index a670320b..97c31270 100644 --- a/rust/src/string.rs +++ b/rust/src/string.rs @@ -34,12 +34,16 @@ pub(crate) fn raw_to_string(ptr: *const c_char) -> Option<String> { } } -// TODO: Make this pass in an iterator over something more generic... -pub(crate) fn strings_to_string_list(strings: &[String]) -> *mut *mut c_char { +pub(crate) fn strings_to_string_list<I, S>(strings: I) -> *mut *mut c_char +where + I: IntoIterator<Item = S>, + // TODO make `S: BnStrCompatible,` + S: AsRef<str>, +{ use binaryninjacore_sys::BNAllocStringList; let bn_str_list = strings - .iter() - .map(|s| BnString::new(s.as_str())) + .into_iter() + .map(|s| BnString::new(s.as_ref())) .collect::<Vec<_>>(); let mut raw_str_list = bn_str_list.iter().map(|s| s.as_ptr()).collect::<Vec<_>>(); unsafe { BNAllocStringList(raw_str_list.as_mut_ptr(), raw_str_list.len()) } |
