binaryninja::types

Struct Type

source
pub struct Type { /* private fields */ }

Implementations§

source§

impl Type

let bv = binaryninja::load("example.bin").unwrap();
let my_custom_type_1 = Type::named_int(5, false, "my_w");
let my_custom_type_2 = Type::int(5, false);
bv.define_user_type("int_1", &my_custom_type_1);
bv.define_user_type("int_2", &my_custom_type_2);
source

pub fn to_builder(&self) -> TypeBuilder

source

pub fn type_class(&self) -> TypeClass

source

pub fn width(&self) -> u64

source

pub fn alignment(&self) -> usize

source

pub fn is_signed(&self) -> Conf<bool>

source

pub fn is_const(&self) -> Conf<bool>

source

pub fn is_volatile(&self) -> Conf<bool>

source

pub fn is_floating_point(&self) -> bool

source

pub fn child_type(&self) -> Option<Conf<Ref<Type>>>

source

pub fn target(&self) -> Option<Conf<Ref<Type>>>

This is an alias for Self::child_type.

source

pub fn element_type(&self) -> Option<Conf<Ref<Type>>>

This is an alias for Self::child_type.

source

pub fn return_value(&self) -> Option<Conf<Ref<Type>>>

This is an alias for Self::child_type.

source

pub fn calling_convention(&self) -> Option<Conf<Ref<CoreCallingConvention>>>

source

pub fn parameters(&self) -> Option<Vec<FunctionParameter>>

source

pub fn has_variable_arguments(&self) -> Conf<bool>

source

pub fn can_return(&self) -> Conf<bool>

source

pub fn pure(&self) -> Conf<bool>

source

pub fn get_structure(&self) -> Option<Ref<Structure>>

source

pub fn get_enumeration(&self) -> Option<Ref<Enumeration>>

source

pub fn get_named_type_reference(&self) -> Option<Ref<NamedTypeReference>>

source

pub fn count(&self) -> u64

source

pub fn offset(&self) -> u64

source

pub fn stack_adjustment(&self) -> Conf<i64>

source

pub fn registered_name(&self) -> Option<Ref<NamedTypeReference>>

source

pub fn void() -> Ref<Self>

source

pub fn bool() -> Ref<Self>

source

pub fn char() -> Ref<Self>

source

pub fn wide_char(width: usize) -> Ref<Self>

source

pub fn int(width: usize, is_signed: bool) -> Ref<Self>

source

pub fn named_int<S: BnStrCompatible>( width: usize, is_signed: bool, alt_name: S, ) -> Ref<Self>

source

pub fn float(width: usize) -> Ref<Self>

source

pub fn named_float<S: BnStrCompatible>(width: usize, alt_name: S) -> Ref<Self>

source

pub fn array<'a, T: Into<Conf<&'a Type>>>(ty: T, count: u64) -> Ref<Self>

source

pub fn enumeration<T: Into<Conf<bool>>>( enumeration: &Enumeration, width: NonZeroUsize, is_signed: T, ) -> Ref<Self>

§NOTE

The C/C++ APIs require an associated architecture, but in the core we only query the default_int_size if the given width is 0.

For simplicity’s sake, that convention isn’t followed, and you can query Architecture::default_integer_size if you need to.

source

pub fn structure(structure: &Structure) -> Ref<Self>

source

pub fn named_type(type_reference: &NamedTypeReference) -> Ref<Self>

source

pub fn named_type_from_type<T: Into<QualifiedName>>( name: T, t: &Type, ) -> Ref<Self>

source

pub fn function<'a, T: Into<Conf<&'a Type>>>( return_type: T, parameters: Vec<FunctionParameter>, variable_arguments: bool, ) -> Ref<Self>

source

pub fn function_with_opts<'a, T: Into<Conf<&'a Type>>, C: Into<Conf<Ref<CoreCallingConvention>>>>( return_type: T, parameters: &[FunctionParameter], variable_arguments: bool, calling_convention: C, stack_adjust: Conf<i64>, ) -> Ref<Self>

source

pub fn pointer<'a, A: Architecture, T: Into<Conf<&'a Type>>>( arch: &A, ty: T, ) -> Ref<Self>

source

pub fn const_pointer<'a, A: Architecture, T: Into<Conf<&'a Type>>>( arch: &A, ty: T, ) -> Ref<Self>

source

pub fn pointer_of_width<'a, T: Into<Conf<&'a Type>>>( ty: T, size: usize, is_const: bool, is_volatile: bool, ref_type: Option<ReferenceType>, ) -> Ref<Self>

source

pub fn pointer_with_options<'a, A: Architecture, T: Into<Conf<&'a Type>>>( arch: &A, ty: T, is_const: bool, is_volatile: bool, ref_type: Option<ReferenceType>, ) -> Ref<Self>

source

pub fn generate_auto_demangled_type_id<T: Into<QualifiedName>>( name: T, ) -> BnString

Trait Implementations§

source§

impl CoreArrayProvider for Type

source§

impl Debug for Type

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Type

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Type

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Type

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToOwned for Type

source§

type Owned = Ref<Type>

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl Eq for Type

source§

impl Send for Type

source§

impl Sync for Type

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.