summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/disassembly.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/rust/src/disassembly.rs b/rust/src/disassembly.rs
index 1fd51cee..e3766f32 100644
--- a/rust/src/disassembly.rs
+++ b/rust/src/disassembly.rs
@@ -103,6 +103,10 @@ impl InstructionTextToken {
mem::transmute(raw)
}
+ pub(crate) fn into_raw(self) -> BNInstructionTextToken {
+ mem::ManuallyDrop::new(self).0
+ }
+
pub fn new(text: &str, contents: InstructionTextTokenContents) -> Self {
let (value, address) = match contents {
InstructionTextTokenContents::Integer(v) => (v, 0),
@@ -378,7 +382,7 @@ impl From<&Vec<&str>> for DisassemblyTextLine {
fn from(string_tokens: &Vec<&str>) -> Self {
let mut tokens: Box<[BNInstructionTextToken]> = string_tokens
.iter()
- .map(|&token| InstructionTextToken::new(token, InstructionTextTokenContents::Text).0)
+ .map(|&token| InstructionTextToken::new(token, InstructionTextTokenContents::Text).into_raw())
.collect();
// let (tokens_pointer, tokens_len, _) = unsafe { tokens.into_raw_parts() }; // Can't use for now...still a rust nighly feature