diff options
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/binaryview.rs | 11 | ||||
| -rw-r--r-- | rust/src/tags.rs | 11 |
2 files changed, 11 insertions, 11 deletions
diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs index 15f3030c..00069c15 100644 --- a/rust/src/binaryview.rs +++ b/rust/src/binaryview.rs @@ -679,9 +679,7 @@ pub trait BinaryViewExt: BinaryViewBase { name: N, icon: I, ) -> Ref<TagType> { - let tag_type = TagType::create(self.as_ref()); - tag_type.set_name(name); - tag_type.set_icon(icon); + let tag_type = TagType::create(self.as_ref(), name, icon); unsafe { BNAddTagType(self.as_ref().handle, tag_type.handle); } @@ -726,12 +724,7 @@ pub trait BinaryViewExt: BinaryViewBase { } } - fn create_tag<S: BnStrCompatible>( - &self, - t: &TagType, - data: S, - user: bool, - ) -> Ref<Tag> { + fn create_tag<S: BnStrCompatible>(&self, t: &TagType, data: S, user: bool) -> Ref<Tag> { let tag = Tag::new(t, data); unsafe { BNAddTag(self.as_ref().handle, tag.handle, user) } tag diff --git a/rust/src/tags.rs b/rust/src/tags.rs index eddcc5f0..ac66b279 100644 --- a/rust/src/tags.rs +++ b/rust/src/tags.rs @@ -83,8 +83,15 @@ impl TagType { Ref::new(Self { handle }) } - pub(crate) fn create(view: &BinaryView) -> Ref<Self> { - unsafe { Self::from_raw(BNCreateTagType(view.handle)) } + pub fn create<N: BnStrCompatible, I: BnStrCompatible>( + view: &BinaryView, + name: N, + icon: I, + ) -> Ref<Self> { + let tag_type = unsafe { Self::from_raw(BNCreateTagType(view.handle)) }; + tag_type.set_name(name); + tag_type.set_icon(icon); + tag_type } pub fn id(&self) -> BnString { |
