Skip to content

Commit 82f8c1b

Browse files
committed
feat: Rename "RustStringSlice" type to "&str"
1 parent f85cb0a commit 82f8c1b

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

binja_plugin/actions.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
@dataclass
2121
class RustStringSlice:
22+
"""
23+
Class to work with the string slice type in Rust, &str
24+
"""
25+
2226
address: int
2327
length: int
2428
data: bytes
@@ -42,15 +46,15 @@ def create_binary_ninja_type(cls, bv: BinaryView):
4246
)
4347

4448
bv.define_user_type(
45-
name="RustStringSlice",
49+
name="&str",
4650
type_obj=rust_string_slice_bn_type_obj,
4751
)
48-
logger.log_info(f"Defined new RustStringSlice type")
52+
logger.log_info(f"Defined new type, `&str`, for Rust string slices")
4953

5054
@classmethod
5155
def create_binary_ninja_instance(cls, bv: BinaryView, location: int, name: str):
52-
bv.define_user_data_var(addr=location, var_type="RustStringSlice", name=name)
53-
logger.log_info(f"Defined new RustStringSlice at {location:#x}")
56+
bv.define_user_data_var(addr=location, var_type="`&str`", name=name)
57+
logger.log_info(f"Defined new `&str` at {location:#x}")
5458

5559

5660
class RecoverStringFromReadOnlyDataTask(BackgroundTaskThread):

0 commit comments

Comments
 (0)