inkwell::types

Enum BasicTypeEnum

source
pub enum BasicTypeEnum<'ctx> {
    ArrayType(ArrayType<'ctx>),
    FloatType(FloatType<'ctx>),
    IntType(IntType<'ctx>),
    PointerType(PointerType<'ctx>),
    StructType(StructType<'ctx>),
    VectorType(VectorType<'ctx>),
}
Expand description

A wrapper for any BasicType.

Variants§

§

ArrayType(ArrayType<'ctx>)

A contiguous homogeneous container type.

§

FloatType(FloatType<'ctx>)

A floating point type.

§

IntType(IntType<'ctx>)

An integer type.

§

PointerType(PointerType<'ctx>)

A pointer type.

§

StructType(StructType<'ctx>)

A contiguous heterogeneous container type.

§

VectorType(VectorType<'ctx>)

A contiguous homogeneous “SIMD” container type.

Implementations§

source§

impl<'ctx> BasicTypeEnum<'ctx>

source

pub unsafe fn new(type_: LLVMTypeRef) -> Self

Create BasicTypeEnum from LLVMTypeRef

§Safety

Undefined behavior, if referenced type isn’t part of basic type enum.

source

pub fn into_array_type(self) -> ArrayType<'ctx>

source

pub fn into_float_type(self) -> FloatType<'ctx>

source

pub fn into_int_type(self) -> IntType<'ctx>

source

pub fn into_pointer_type(self) -> PointerType<'ctx>

source

pub fn into_struct_type(self) -> StructType<'ctx>

source

pub fn into_vector_type(self) -> VectorType<'ctx>

source

pub fn is_array_type(self) -> bool

source

pub fn is_float_type(self) -> bool

source

pub fn is_int_type(self) -> bool

source

pub fn is_pointer_type(self) -> bool

source

pub fn is_struct_type(self) -> bool

source

pub fn is_vector_type(self) -> bool

source

pub fn const_zero(self) -> BasicValueEnum<'ctx>

Creates a constant BasicValueZero.

§Example
use inkwell::context::Context;
use crate::inkwell::types::BasicType;

let context = Context::create();
let f32_type = context.f32_type().as_basic_type_enum();
let f32_zero = f32_type.const_zero();
source

pub fn print_to_string(self) -> LLVMString

Print the definition of a BasicTypeEnum to LLVMString.

Trait Implementations§

source§

impl<'ctx> AnyType<'ctx> for BasicTypeEnum<'ctx>

source§

fn as_any_type_enum(&self) -> AnyTypeEnum<'ctx>

Returns an AnyTypeEnum that represents the current type.
source§

fn print_to_string(&self) -> LLVMString

Prints the definition of a Type to a LLVMString.
source§

impl AsTypeRef for BasicTypeEnum<'_>

source§

fn as_type_ref(&self) -> LLVMTypeRef

Returns the internal LLVM reference behind the type
source§

impl<'ctx> BasicType<'ctx> for BasicTypeEnum<'ctx>

source§

fn as_basic_type_enum(&self) -> BasicTypeEnum<'ctx>

Returns a BasicTypeEnum that represents the current type.
source§

fn fn_type( &self, param_types: &[BasicMetadataTypeEnum<'ctx>], is_var_args: bool, ) -> FunctionType<'ctx>

Create a FunctionType with this BasicType as its return type. Read more
source§

fn is_sized(&self) -> bool

Determines whether or not this BasicType is sized or not. For example, opaque structs are unsized. Read more
source§

fn size_of(&self) -> Option<IntValue<'ctx>>

Gets the size of this BasicType. Value may vary depending on the target architecture. Read more
source§

fn array_type(&self, size: u32) -> ArrayType<'ctx>

Create an ArrayType with this BasicType as its elements. Read more
source§

fn ptr_type(&self, address_space: AddressSpace) -> PointerType<'ctx>

👎Deprecated: Starting from version 15.0, LLVM doesn’t differentiate between pointer types. Use Context::ptr_type instead.
Create a PointerType that points to this BasicType. Read more
source§

impl<'ctx> Clone for BasicTypeEnum<'ctx>

source§

fn clone(&self) -> BasicTypeEnum<'ctx>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'ctx> Debug for BasicTypeEnum<'ctx>

source§

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

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

impl Display for BasicTypeEnum<'_>

source§

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

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

impl<'ctx> From<ArrayType<'ctx>> for BasicTypeEnum<'ctx>

source§

fn from(value: ArrayType<'_>) -> BasicTypeEnum<'_>

Converts to this type from the input type.
source§

impl<'ctx> From<BasicTypeEnum<'ctx>> for BasicMetadataTypeEnum<'ctx>

source§

fn from(value: BasicTypeEnum<'ctx>) -> Self

Converts to this type from the input type.
source§

impl<'ctx> From<FloatType<'ctx>> for BasicTypeEnum<'ctx>

source§

fn from(value: FloatType<'_>) -> BasicTypeEnum<'_>

Converts to this type from the input type.
source§

impl<'ctx> From<IntType<'ctx>> for BasicTypeEnum<'ctx>

source§

fn from(value: IntType<'_>) -> BasicTypeEnum<'_>

Converts to this type from the input type.
source§

impl<'ctx> From<PointerType<'ctx>> for BasicTypeEnum<'ctx>

source§

fn from(value: PointerType<'_>) -> BasicTypeEnum<'_>

Converts to this type from the input type.
source§

impl<'ctx> From<StructType<'ctx>> for BasicTypeEnum<'ctx>

source§

fn from(value: StructType<'_>) -> BasicTypeEnum<'_>

Converts to this type from the input type.
source§

impl<'ctx> From<VectorType<'ctx>> for BasicTypeEnum<'ctx>

source§

fn from(value: VectorType<'_>) -> BasicTypeEnum<'_>

Converts to this type from the input type.
source§

impl<'ctx> PartialEq for BasicTypeEnum<'ctx>

source§

fn eq(&self, other: &BasicTypeEnum<'ctx>) -> 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<'ctx> TryFrom<AnyTypeEnum<'ctx>> for BasicTypeEnum<'ctx>

source§

type Error = ()

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

fn try_from(value: AnyTypeEnum<'ctx>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'ctx> TryFrom<BasicMetadataTypeEnum<'ctx>> for BasicTypeEnum<'ctx>

source§

type Error = ()

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

fn try_from(value: BasicMetadataTypeEnum<'ctx>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for ArrayType<'ctx>

source§

type Error = ()

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

fn try_from(value: BasicTypeEnum<'ctx>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for FloatType<'ctx>

source§

type Error = ()

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

fn try_from(value: BasicTypeEnum<'ctx>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for IntType<'ctx>

source§

type Error = ()

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

fn try_from(value: BasicTypeEnum<'ctx>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for PointerType<'ctx>

source§

type Error = ()

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

fn try_from(value: BasicTypeEnum<'ctx>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for StructType<'ctx>

source§

type Error = ()

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

fn try_from(value: BasicTypeEnum<'ctx>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for VectorType<'ctx>

source§

type Error = ()

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

fn try_from(value: BasicTypeEnum<'ctx>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'ctx> Copy for BasicTypeEnum<'ctx>

source§

impl<'ctx> Eq for BasicTypeEnum<'ctx>

source§

impl<'ctx> StructuralPartialEq for BasicTypeEnum<'ctx>

Auto Trait Implementations§

§

impl<'ctx> Freeze for BasicTypeEnum<'ctx>

§

impl<'ctx> RefUnwindSafe for BasicTypeEnum<'ctx>

§

impl<'ctx> !Send for BasicTypeEnum<'ctx>

§

impl<'ctx> !Sync for BasicTypeEnum<'ctx>

§

impl<'ctx> Unpin for BasicTypeEnum<'ctx>

§

impl<'ctx> UnwindSafe for BasicTypeEnum<'ctx>

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.