Struct binaryninja::types::StructureBuilder
source · [−]pub struct StructureBuilder { /* private fields */ }
Implementations
sourceimpl StructureBuilder
impl StructureBuilder
// Includes
use binaryninja::types::{Structure, Type};
// 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.append(&field_1, "field_4");
my_custom_struct.insert(&field_1, "field_1", 0);
my_custom_struct.insert(&field_2, "field_2", 5);
my_custom_struct.insert(&field_3, "field_3", 9);
// Convert structure to type
let my_custom_structure_type = Self::structure_type(&mut my_custom_struct);
// Add the struct to the binary view to use in analysis
let bv = unsafe { BinaryView::from_raw(view) };
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>>
Trait Implementations
sourceimpl Debug for StructureBuilder
impl Debug for StructureBuilder
sourceimpl Default for StructureBuilder
impl Default for StructureBuilder
sourceimpl Drop for StructureBuilder
impl Drop for StructureBuilder
sourceimpl From<&Structure> for StructureBuilder
impl From<&Structure> for StructureBuilder
sourcefn from(structure: &Structure) -> StructureBuilder
fn from(structure: &Structure) -> StructureBuilder
Converts to this type from the input type.
sourceimpl From<Vec<StructureMember, Global>> for StructureBuilder
impl From<Vec<StructureMember, Global>> for StructureBuilder
sourcefn from(members: Vec<StructureMember>) -> StructureBuilder
fn from(members: Vec<StructureMember>) -> StructureBuilder
Converts to this type from the input type.
sourceimpl Hash for StructureBuilder
impl Hash for StructureBuilder
sourceimpl PartialEq<StructureBuilder> for StructureBuilder
impl PartialEq<StructureBuilder> for StructureBuilder
sourcefn eq(&self, other: &StructureBuilder) -> bool
fn eq(&self, other: &StructureBuilder) -> bool
impl Eq for StructureBuilder
impl StructuralEq 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more