Skip to main content

TypeBuilder

Struct TypeBuilder 

Source
pub struct TypeBuilder { /* private fields */ }

Implementations§

Source§

impl TypeBuilder

Source

pub fn new(t: &Type) -> Self

Source

pub fn finalize(&self) -> Ref<Type>

Turn the TypeBuilder into a Type.

Source

pub fn set_can_return<T: Into<Conf<bool>>>(&self, value: T) -> &Self

Source

pub fn set_pure<T: Into<Conf<bool>>>(&self, value: T) -> &Self

Source

pub fn set_const<T: Into<Conf<bool>>>(&self, value: T) -> &Self

Source

pub fn set_volatile<T: Into<Conf<bool>>>(&self, value: T) -> &Self

Source

pub fn set_width(&self, width: usize) -> &Self

Set the width of the type.

Typically only done for named type references, which will not have their width set otherwise.

Source

pub fn set_alignment(&self, alignment: usize) -> &Self

Set the alignment of the type.

Typically only done for named type references, which will not have their alignment set otherwise.

Source

pub fn set_pointer_base( &self, base_type: PointerBaseType, base_offset: i64, ) -> &Self

Source

pub fn set_child_type<'a, T: Into<Conf<&'a Type>>>(&self, ty: T) -> &Self

Source

pub fn set_target<'a, T: Into<Conf<&'a Type>>>(&self, ty: T) -> &Self

This is an alias for Self::set_child_type.

Source

pub fn set_element_type<'a, T: Into<Conf<&'a Type>>>(&self, ty: T) -> &Self

This is an alias for Self::set_child_type.

Source

pub fn set_return_value<'a, T: Into<Conf<&'a Type>>>(&self, ty: T) -> &Self

This is an alias for Self::set_child_type.

Source

pub fn set_signed<T: Into<Conf<bool>>>(&self, value: T) -> &Self

Source

pub fn set_integer_display_type( &self, display_type: IntegerDisplayType, ) -> &Self

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 integer_display_type(&self) -> IntegerDisplayType

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 pointer_base_type(&self) -> PointerBaseType

Source

pub fn pointer_base_offset(&self) -> i64

Source

pub fn void() -> Self

Create a void TypeBuilder. Analogous to Type::void.

Source

pub fn bool() -> Self

Create a bool TypeBuilder. Analogous to Type::bool.

Source

pub fn char() -> Self

Create a signed one byte integer TypeBuilder. Analogous to Type::char.

Source

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

Create an integer TypeBuilder with the given width and signedness. Analogous to Type::int.

Source

pub fn named_int(width: usize, is_signed: bool, alt_name: &str) -> Self

Create an integer TypeBuilder with the given width and signedness and an alternative name. Analogous to Type::named_int.

Source

pub fn float(width: usize) -> Self

Create a float TypeBuilder with the given width. Analogous to Type::float.

Source

pub fn named_float(width: usize, alt_name: &str) -> Self

Create a float TypeBuilder with the given width and alternative name. Analogous to Type::named_float.

Source

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

Create an array TypeBuilder with the given element type and count. Analogous to Type::array.

Source

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

Create an enumeration TypeBuilder with the given width and signedness. Analogous to Type::enumeration.

§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_type: &Structure) -> Self

Create a structure TypeBuilder. Analogous to Type::structure.

Source

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

Create a named type reference TypeBuilder. Analogous to Type::named_type.

Source

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

Create a named type reference TypeBuilder from a type and name. Analogous to Type::named_type_from_type.

Source

pub fn function<T: Into<ReturnValue>>( return_value: T, parameters: Vec<FunctionParameter>, variable_arguments: bool, ) -> Self

NOTE: This is likely to be deprecated and removed in favor of a function type builder, please use Type::function where possible.

Source

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

NOTE: This is likely to be deprecated and removed in favor of a function type builder, please use Type::function_with_opts where possible.

Source

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

Create a pointer TypeBuilder with the given target type. Analogous to Type::pointer.

Source

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

Create a const pointer TypeBuilder with the given target type. Analogous to Type::const_pointer.

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

Trait Implementations§

Source§

impl Display for TypeBuilder

Source§

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

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

impl Drop for TypeBuilder

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics #130494)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Eq for TypeBuilder

Source§

impl Hash for TypeBuilder

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 TypeBuilder

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for TypeBuilder

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more