Skip to content

Commit 5489c5b

Browse files
committed
[Rust] Add TypeBuilder::set_child_type
1 parent 0eebe78 commit 5489c5b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

rust/src/types.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,27 @@ impl TypeBuilder {
101101
self
102102
}
103103

104+
pub fn set_child_type<'a, T: Into<Conf<&'a Type>>>(&self, ty: T) -> &Self {
105+
let mut type_with_confidence = Conf::<&Type>::into_raw(ty.into());
106+
unsafe { BNTypeBuilderSetChildType(self.handle, &mut type_with_confidence) };
107+
self
108+
}
109+
110+
/// This is an alias for [`Self::set_child_type`].
111+
pub fn set_target<'a, T: Into<Conf<&'a Type>>>(&self, ty: T) -> &Self {
112+
self.set_child_type(ty)
113+
}
114+
115+
/// This is an alias for [`Self::set_child_type`].
116+
pub fn set_element_type<'a, T: Into<Conf<&'a Type>>>(&self, ty: T) -> &Self {
117+
self.set_child_type(ty)
118+
}
119+
120+
/// This is an alias for [`Self::set_child_type`].
121+
pub fn set_return_value<'a, T: Into<Conf<&'a Type>>>(&self, ty: T) -> &Self {
122+
self.set_child_type(ty)
123+
}
124+
104125
// Readable properties
105126

106127
pub fn type_class(&self) -> TypeClass {

0 commit comments

Comments
 (0)