Struct binaryninja::types::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 target(&self) -> Result<Conf<Ref<Type>>>

source

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

source

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

source

pub fn calling_convention( &self ) -> Result<Conf<Ref<CallingConvention<CoreArchitecture>>>>

source

pub fn parameters(&self) -> Result<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) -> Result<Ref<Structure>>

source

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

source

pub fn get_named_type_reference(&self) -> Result<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) -> Result<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>>>(t: T, count: u64) -> Ref<Self>

source

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

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 the default_int_size from an arch, if you have it, 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<S: BnStrCompatible>(name: S, t: &Type) -> Ref<Self>

source

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

source

pub fn function_with_options<'a, A: Architecture, T: Into<Conf<&'a Type>>, C: Into<Conf<&'a CallingConvention<A>>>>( 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, t: T ) -> Ref<Self>

source

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

source

pub fn pointer_of_width<'a, T: Into<Conf<&'a Type>>>( t: 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, t: T, is_const: bool, is_volatile: bool, ref_type: Option<ReferenceType> ) -> Ref<Self>

source

pub fn generate_auto_demangled_type_id<S: BnStrCompatible>(name: S) -> BnString

Trait Implementations§

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

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

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

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

impl ToOwned for Type

§

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§

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>,

§

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>,

§

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.