From 5489c5b71773ac020f0c9dec134fe92310d4cb36 Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Fri, 5 Sep 2025 08:01:05 -0700 Subject: [Rust] Add TypeBuilder::set_child_type --- rust/src/types.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'rust/src') diff --git a/rust/src/types.rs b/rust/src/types.rs index 33a08583..036e53f5 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -101,6 +101,27 @@ impl TypeBuilder { self } + pub fn set_child_type<'a, T: Into>>(&self, ty: T) -> &Self { + let mut type_with_confidence = Conf::<&Type>::into_raw(ty.into()); + unsafe { BNTypeBuilderSetChildType(self.handle, &mut type_with_confidence) }; + self + } + + /// This is an alias for [`Self::set_child_type`]. + pub fn set_target<'a, T: Into>>(&self, ty: T) -> &Self { + self.set_child_type(ty) + } + + /// This is an alias for [`Self::set_child_type`]. + pub fn set_element_type<'a, T: Into>>(&self, ty: T) -> &Self { + self.set_child_type(ty) + } + + /// This is an alias for [`Self::set_child_type`]. + pub fn set_return_value<'a, T: Into>>(&self, ty: T) -> &Self { + self.set_child_type(ty) + } + // Readable properties pub fn type_class(&self) -> TypeClass { -- cgit v1.3.1