diff options
| author | Mark Rowe <mark@vector35.com> | 2025-09-05 08:01:05 -0700 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2025-09-17 21:28:50 -0700 |
| commit | 5489c5b71773ac020f0c9dec134fe92310d4cb36 (patch) | |
| tree | 013b90ac04080669cbc573be83d046de29dbc3b3 /rust/src | |
| parent | 0eebe782656ba2ceaa5a69a50bb3636b8ea33208 (diff) | |
[Rust] Add TypeBuilder::set_child_type
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/types.rs | 21 |
1 files changed, 21 insertions, 0 deletions
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<Conf<&'a Type>>>(&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<Conf<&'a Type>>>(&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<Conf<&'a Type>>>(&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<Conf<&'a Type>>>(&self, ty: T) -> &Self { + self.set_child_type(ty) + } + // Readable properties pub fn type_class(&self) -> TypeClass { |
