(value: &BNDisassemblyTextLine)
| 60 | |
| 61 | impl DisassemblyTextLine { |
| 62 | pub(crate) fn from_raw(value: &BNDisassemblyTextLine) -> Self { |
| 63 | let raw_tokens = unsafe { std::slice::from_raw_parts(value.tokens, value.count) }; |
| 64 | let tokens: Vec<_> = raw_tokens |
| 65 | .iter() |
| 66 | .map(InstructionTextToken::from_raw) |
| 67 | .collect(); |
| 68 | // SAFETY: Increment the tag ref as we are going from ref to owned. |
| 69 | let raw_tags = unsafe { std::slice::from_raw_parts(value.tags, value.tagCount) }; |
| 70 | let tags: Vec<_> = raw_tags |
| 71 | .iter() |
| 72 | .map(|&t| unsafe { Tag::from_raw(t) }.to_owned()) |
| 73 | .collect(); |
| 74 | Self { |
| 75 | address: value.addr, |
| 76 | instruction_index: value.instrIndex, |
| 77 | tokens, |
| 78 | highlight: value.highlight.into(), |
| 79 | tags, |
| 80 | type_info: DisassemblyTextLineTypeInfo::from_raw(&value.typeInfo), |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /// Convert into a raw [BNDisassemblyTextLine], use with caution. |
| 85 | /// |
nothing calls this directly
no test coverage detected