Enum inkwell::types::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>
impl<'ctx> BasicTypeEnum<'ctx>
sourcepub unsafe fn new(type_: LLVMTypeRef) -> Self
pub unsafe fn new(type_: LLVMTypeRef) -> Self
Create BasicTypeEnum
from LLVMTypeRef
Safety
Undefined behavior, if referenced type isn’t part of basic type enum.
pub fn into_array_type(self) -> ArrayType<'ctx>
pub fn into_float_type(self) -> FloatType<'ctx>
pub fn into_int_type(self) -> IntType<'ctx>
pub fn into_pointer_type(self) -> PointerType<'ctx>
pub fn into_struct_type(self) -> StructType<'ctx>
pub fn into_vector_type(self) -> VectorType<'ctx>
pub fn is_array_type(self) -> bool
pub fn is_float_type(self) -> bool
pub fn is_int_type(self) -> bool
pub fn is_pointer_type(self) -> bool
pub fn is_struct_type(self) -> bool
pub fn is_vector_type(self) -> bool
sourcepub fn const_zero(self) -> BasicValueEnum<'ctx>
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();
sourcepub fn print_to_string(self) -> LLVMString
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>
impl<'ctx> AnyType<'ctx> for BasicTypeEnum<'ctx>
source§fn as_any_type_enum(&self) -> AnyTypeEnum<'ctx>
fn as_any_type_enum(&self) -> AnyTypeEnum<'ctx>
Returns an
AnyTypeEnum
that represents the current type.source§fn print_to_string(&self) -> LLVMString
fn print_to_string(&self) -> LLVMString
Prints the definition of a Type to a
LLVMString
.source§impl AsTypeRef for BasicTypeEnum<'_>
impl AsTypeRef for BasicTypeEnum<'_>
source§fn as_type_ref(&self) -> LLVMTypeRef
fn as_type_ref(&self) -> LLVMTypeRef
Returns the internal LLVM reference behind the type
source§impl<'ctx> BasicType<'ctx> for BasicTypeEnum<'ctx>
impl<'ctx> BasicType<'ctx> for BasicTypeEnum<'ctx>
source§fn as_basic_type_enum(&self) -> BasicTypeEnum<'ctx>
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>
fn fn_type( &self, param_types: &[BasicMetadataTypeEnum<'ctx>], is_var_args: bool ) -> FunctionType<'ctx>
source§fn is_sized(&self) -> bool
fn is_sized(&self) -> bool
Determines whether or not this
BasicType
is sized or not.
For example, opaque structs are unsized. Read moresource§fn size_of(&self) -> Option<IntValue<'ctx>>
fn size_of(&self) -> Option<IntValue<'ctx>>
Gets the size of this
BasicType
. Value may vary depending on the target architecture. Read moresource§fn array_type(&self, size: u32) -> ArrayType<'ctx>
fn array_type(&self, size: u32) -> ArrayType<'ctx>
source§fn ptr_type(&self, address_space: AddressSpace) -> PointerType<'ctx>
fn ptr_type(&self, address_space: AddressSpace) -> PointerType<'ctx>
source§impl<'ctx> Clone for BasicTypeEnum<'ctx>
impl<'ctx> Clone for BasicTypeEnum<'ctx>
source§fn clone(&self) -> BasicTypeEnum<'ctx>
fn clone(&self) -> BasicTypeEnum<'ctx>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'ctx> Debug for BasicTypeEnum<'ctx>
impl<'ctx> Debug for BasicTypeEnum<'ctx>
source§impl Display for BasicTypeEnum<'_>
impl Display for BasicTypeEnum<'_>
source§impl<'ctx> From<ArrayType<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> From<ArrayType<'ctx>> for BasicTypeEnum<'ctx>
source§fn from(value: ArrayType<'_>) -> BasicTypeEnum<'_>
fn from(value: ArrayType<'_>) -> BasicTypeEnum<'_>
Converts to this type from the input type.
source§impl<'ctx> From<BasicTypeEnum<'ctx>> for BasicMetadataTypeEnum<'ctx>
impl<'ctx> From<BasicTypeEnum<'ctx>> for BasicMetadataTypeEnum<'ctx>
source§fn from(value: BasicTypeEnum<'ctx>) -> Self
fn from(value: BasicTypeEnum<'ctx>) -> Self
Converts to this type from the input type.
source§impl<'ctx> From<FloatType<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> From<FloatType<'ctx>> for BasicTypeEnum<'ctx>
source§fn from(value: FloatType<'_>) -> BasicTypeEnum<'_>
fn from(value: FloatType<'_>) -> BasicTypeEnum<'_>
Converts to this type from the input type.
source§impl<'ctx> From<IntType<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> From<IntType<'ctx>> for BasicTypeEnum<'ctx>
source§fn from(value: IntType<'_>) -> BasicTypeEnum<'_>
fn from(value: IntType<'_>) -> BasicTypeEnum<'_>
Converts to this type from the input type.
source§impl<'ctx> From<PointerType<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> From<PointerType<'ctx>> for BasicTypeEnum<'ctx>
source§fn from(value: PointerType<'_>) -> BasicTypeEnum<'_>
fn from(value: PointerType<'_>) -> BasicTypeEnum<'_>
Converts to this type from the input type.
source§impl<'ctx> From<StructType<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> From<StructType<'ctx>> for BasicTypeEnum<'ctx>
source§fn from(value: StructType<'_>) -> BasicTypeEnum<'_>
fn from(value: StructType<'_>) -> BasicTypeEnum<'_>
Converts to this type from the input type.
source§impl<'ctx> From<VectorType<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> From<VectorType<'ctx>> for BasicTypeEnum<'ctx>
source§fn from(value: VectorType<'_>) -> BasicTypeEnum<'_>
fn from(value: VectorType<'_>) -> BasicTypeEnum<'_>
Converts to this type from the input type.
source§impl<'ctx> PartialEq for BasicTypeEnum<'ctx>
impl<'ctx> PartialEq for BasicTypeEnum<'ctx>
source§fn eq(&self, other: &BasicTypeEnum<'ctx>) -> bool
fn eq(&self, other: &BasicTypeEnum<'ctx>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for BasicTypeEnum<'ctx>
source§impl<'ctx> TryFrom<BasicMetadataTypeEnum<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> TryFrom<BasicMetadataTypeEnum<'ctx>> for BasicTypeEnum<'ctx>
source§impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for ArrayType<'ctx>
impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for ArrayType<'ctx>
source§impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for FloatType<'ctx>
impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for FloatType<'ctx>
source§impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for IntType<'ctx>
impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for IntType<'ctx>
source§impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for PointerType<'ctx>
impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for PointerType<'ctx>
source§impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for StructType<'ctx>
impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for StructType<'ctx>
source§impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for VectorType<'ctx>
impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for VectorType<'ctx>
impl<'ctx> Copy for BasicTypeEnum<'ctx>
impl<'ctx> Eq for BasicTypeEnum<'ctx>
impl<'ctx> StructuralEq for BasicTypeEnum<'ctx>
impl<'ctx> StructuralPartialEq for BasicTypeEnum<'ctx>
Auto Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more