Struct binaryninja::types::StructureBuilder
source · pub struct StructureBuilder { /* private fields */ }
Implementations§
source§impl StructureBuilder
impl StructureBuilder
// Includes
use binaryninja::types::{Structure, StructureBuilder, Type, MemberAccess, MemberScope};
// Define struct, set size (in bytes)
let mut my_custom_struct = StructureBuilder::new();
let field_1 = Type::named_int(5, false, "my_weird_int_type");
let field_2 = Type::int(4, false);
let field_3 = Type::int(8, false);
// Assign those fields
my_custom_struct.insert(&field_1, "field_1", 0, false, MemberAccess::PublicAccess, MemberScope::NoScope);
my_custom_struct.insert(&field_2, "field_2", 5, false, MemberAccess::PublicAccess, MemberScope::NoScope);
my_custom_struct.insert(&field_3, "field_3", 9, false, MemberAccess::PublicAccess, MemberScope::NoScope);
my_custom_struct.append(&field_1, "field_4", MemberAccess::PublicAccess, MemberScope::NoScope);
// Convert structure to type
let my_custom_structure_type = Type::structure(&my_custom_struct.finalize());
// Add the struct to the binary view to use in analysis
let bv = binaryninja::load("example").unwrap();
bv.define_user_type("my_custom_struct", &my_custom_structure_type);
pub fn new() -> Self
pub fn finalize(&self) -> Ref<Structure>
pub fn set_width(&self, width: u64) -> &Self
pub fn set_alignment(&self, alignment: usize) -> &Self
pub fn set_packed(&self, packed: bool) -> &Self
pub fn set_structure_type(&self, t: StructureType) -> &Self
pub fn set_pointer_offset(&self, offset: i64) -> &Self
pub fn set_propagates_data_var_refs(&self, does: bool) -> &Self
pub fn set_base_structures(&self, bases: Vec<BaseStructure>) -> &Self
pub fn append<'a, S: BnStrCompatible, T: Into<Conf<&'a Type>>>( &self, t: T, name: S, access: MemberAccess, scope: MemberScope ) -> &Self
pub fn insert_member( &self, member: &StructureMember, overwrite_existing: bool ) -> &Self
pub fn insert<'a, S: BnStrCompatible, T: Into<Conf<&'a Type>>>( &self, t: T, name: S, offset: u64, overwrite_existing: bool, access: MemberAccess, scope: MemberScope ) -> &Self
pub fn with_members<'a, S: BnStrCompatible, T: Into<Conf<&'a Type>>>( &self, members: impl IntoIterator<Item = (T, S)> ) -> &Self
pub fn width(&self) -> u64
pub fn alignment(&self) -> usize
pub fn packed(&self) -> bool
pub fn structure_type(&self) -> StructureType
pub fn pointer_offset(&self) -> i64
pub fn propagates_data_var_refs(&self) -> bool
pub fn base_structures(&self) -> Result<Vec<BaseStructure>>
pub fn members(&self) -> Array<StructureMember>
pub fn index_by_name(&self, name: &str) -> Option<usize>
pub fn index_by_offset(&self, offset: u64) -> Option<usize>
pub fn clear_members(&self)
pub fn add_members<'a>( &self, members: impl IntoIterator<Item = &'a StructureMember> )
pub fn set_members<'a>( &self, members: impl IntoIterator<Item = &'a StructureMember> )
pub fn remove(&self, index: usize)
pub fn replace( &self, index: usize, type_: Conf<&Type>, name: &str, overwrite: bool )
Trait Implementations§
source§impl Debug for StructureBuilder
impl Debug for StructureBuilder
source§impl Default for StructureBuilder
impl Default for StructureBuilder
source§impl Drop for StructureBuilder
impl Drop for StructureBuilder
source§impl From<&Structure> for StructureBuilder
impl From<&Structure> for StructureBuilder
source§fn from(structure: &Structure) -> StructureBuilder
fn from(structure: &Structure) -> StructureBuilder
Converts to this type from the input type.
source§impl From<Vec<StructureMember>> for StructureBuilder
impl From<Vec<StructureMember>> for StructureBuilder
source§fn from(members: Vec<StructureMember>) -> StructureBuilder
fn from(members: Vec<StructureMember>) -> StructureBuilder
Converts to this type from the input type.
source§impl Hash for StructureBuilder
impl Hash for StructureBuilder
source§impl PartialEq for StructureBuilder
impl PartialEq for StructureBuilder
source§fn eq(&self, other: &StructureBuilder) -> bool
fn eq(&self, other: &StructureBuilder) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for StructureBuilder
impl StructuralPartialEq for StructureBuilder
Auto Trait Implementations§
impl RefUnwindSafe for StructureBuilder
impl !Send for StructureBuilder
impl !Sync for StructureBuilder
impl Unpin for StructureBuilder
impl UnwindSafe for StructureBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more