diff options
| author | Mason Reed <mason@vector35.com> | 2026-01-29 10:14:17 -0800 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-02-23 00:09:44 -0800 |
| commit | 69ef5923e93d75f1d7c2bf06dfac8ab0235c6d63 (patch) | |
| tree | 71eba790ce66d4741e0c8a749c472f10729e60d2 /rust | |
| parent | 017349bdbe171c66974a5835f2f74f76138386ea (diff) | |
[Rust] Provide setters useful for creating NTR references
Need to expose these setters, even if there usage is limited when dealing with NTR reference, something in the core might be unconditionally
retrieving the width or alignment of the type without trying to resolve NTR.
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/src/types.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/rust/src/types.rs b/rust/src/types.rs index 4f6f82d2..bb5b3883 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -123,6 +123,22 @@ impl TypeBuilder { self } + /// Set the width of the type. + /// + /// Typically only done for named type references, which will not have their width set otherwise. + pub fn set_width(&self, width: usize) -> &Self { + unsafe { BNTypeBuilderSetWidth(self.handle, width) } + self + } + + /// Set the alignment of the type. + /// + /// Typically only done for named type references, which will not have their alignment set otherwise. + pub fn set_alignment(&self, alignment: usize) -> &Self { + unsafe { BNTypeBuilderSetAlignment(self.handle, alignment) } + self + } + pub fn set_pointer_base(&self, base_type: PointerBaseType, base_offset: i64) -> &Self { unsafe { BNSetTypeBuilderPointerBase(self.handle, base_type, base_offset) } self @@ -541,6 +557,7 @@ impl Type { // TODO: We need to decide on a public type to represent type width. // TODO: The api uses both `u64` and `usize`, pick one or a new type! + /// The size of the type in bytes. pub fn width(&self) -> u64 { unsafe { BNGetTypeWidth(self.handle) } } |
