From 123bb13826f68cbfa3158e2ebf30ca59a143afb1 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 27 Jan 2025 12:09:50 -0500 Subject: Add `StructureBuilder::current_width` This was removed as the usage was problematic to say the least, adding it back with a warning --- rust/src/types.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'rust/src/types.rs') diff --git a/rust/src/types.rs b/rust/src/types.rs index 54c25234..534b7708 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -1563,6 +1563,14 @@ impl StructureBuilder { unsafe { BNRemoveStructureBuilderMember(self.handle, index) }; self } + + // TODO: We should add BNGetStructureBuilderAlignedWidth + /// Gets the current **unaligned** width of the structure. + /// + /// This cannot be used to accurately get the width of a non-packed structure. + pub fn current_width(&self) -> u64 { + unsafe { BNGetStructureBuilderWidth(self.handle) } + } } impl From<&Structure> for StructureBuilder { -- cgit v1.3.1