Struct llvm_plugin_inkwell::types::ArrayType
source · [−]pub struct ArrayType<'ctx> { /* private fields */ }Expand description
An ArrayType is the type of contiguous constants or variables.
Implementations
sourceimpl<'ctx> ArrayType<'ctx>
impl<'ctx> ArrayType<'ctx>
sourcepub fn size_of(self) -> Option<IntValue<'ctx>>
pub fn size_of(self) -> Option<IntValue<'ctx>>
Gets the size of this ArrayType. Value may vary depending on the target architecture.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_array_type = i8_type.array_type(3);
let i8_array_type_size = i8_array_type.size_of();sourcepub fn get_alignment(self) -> IntValue<'ctx>
pub fn get_alignment(self) -> IntValue<'ctx>
Gets the alignment of this ArrayType. Value may vary depending on the target architecture.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_array_type = i8_type.array_type(3);
let i8_array_type_alignment = i8_array_type.get_alignment();sourcepub fn ptr_type(self, address_space: AddressSpace) -> PointerType<'ctx>
pub fn ptr_type(self, address_space: AddressSpace) -> PointerType<'ctx>
Creates a PointerType with this ArrayType for its element type.
Example
use inkwell::context::Context;
use inkwell::AddressSpace;
let context = Context::create();
let i8_type = context.i8_type();
let i8_array_type = i8_type.array_type(3);
let i8_array_ptr_type = i8_array_type.ptr_type(AddressSpace::Generic);
assert_eq!(i8_array_ptr_type.get_element_type().into_array_type(), i8_array_type);sourcepub fn get_context(self) -> ContextRef<'ctx>
pub fn get_context(self) -> ContextRef<'ctx>
Gets a reference to the Context this ArrayType was created in.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_array_type = i8_type.array_type(3);
assert_eq!(*i8_array_type.get_context(), context);sourcepub fn fn_type(
self,
param_types: &[BasicMetadataTypeEnum<'ctx>],
is_var_args: bool
) -> FunctionType<'ctx>
pub fn fn_type(
self,
param_types: &[BasicMetadataTypeEnum<'ctx>],
is_var_args: bool
) -> FunctionType<'ctx>
Creates a FunctionType with this ArrayType for its return type.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_array_type = i8_type.array_type(3);
let fn_type = i8_array_type.fn_type(&[], false);sourcepub fn array_type(self, size: u32) -> ArrayType<'ctx>
pub fn array_type(self, size: u32) -> ArrayType<'ctx>
Creates an ArrayType with this ArrayType for its element type.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_array_type = i8_type.array_type(3);
let i8_array_array_type = i8_array_type.array_type(3);
assert_eq!(i8_array_array_type.len(), 3);
assert_eq!(i8_array_array_type.get_element_type().into_array_type(), i8_array_type);sourcepub fn const_array(self, values: &[ArrayValue<'ctx>]) -> ArrayValue<'ctx>
pub fn const_array(self, values: &[ArrayValue<'ctx>]) -> ArrayValue<'ctx>
Creates a constant ArrayValue.
Example
use inkwell::context::Context;
let context = Context::create();
let f32_type = context.f32_type();
let f32_array_type = f32_type.array_type(3);
let f32_array_val = f32_array_type.const_zero();
let f32_array_array = f32_array_type.const_array(&[f32_array_val, f32_array_val]);
assert!(f32_array_array.is_const());sourcepub fn const_zero(self) -> ArrayValue<'ctx>
pub fn const_zero(self) -> ArrayValue<'ctx>
Creates a constant zero value of this ArrayType.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_array_type = i8_type.array_type(3);
let i8_array_zero = i8_array_type.const_zero();sourcepub fn len(self) -> u32
pub fn len(self) -> u32
Gets the length of this ArrayType.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_array_type = i8_type.array_type(3);
assert_eq!(i8_array_type.len(), 3);sourcepub fn print_to_string(self) -> LLVMString
pub fn print_to_string(self) -> LLVMString
Print the definition of an ArrayType to LLVMString
sourcepub fn get_undef(self) -> ArrayValue<'ctx>
pub fn get_undef(self) -> ArrayValue<'ctx>
Creates an undefined instance of a ArrayType.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_array_type = i8_type.array_type(3);
let i8_array_undef = i8_array_type.get_undef();
assert!(i8_array_undef.is_undef());sourcepub fn get_element_type(self) -> BasicTypeEnum<'ctx>
pub fn get_element_type(self) -> BasicTypeEnum<'ctx>
Gets the element type of this ArrayType.
Example
use inkwell::context::Context;
let context = Context::create();
let i8_type = context.i8_type();
let i8_array_type = i8_type.array_type(3);
assert_eq!(i8_array_type.get_element_type().into_int_type(), i8_type);Trait Implementations
sourceimpl<'ctx> AnyType<'ctx> for ArrayType<'ctx>
impl<'ctx> AnyType<'ctx> for ArrayType<'ctx>
sourcefn as_any_type_enum(&self) -> AnyTypeEnum<'ctx>
fn as_any_type_enum(&self) -> AnyTypeEnum<'ctx>
Returns an AnyTypeEnum that represents the current type.
sourcefn print_to_string(&self) -> LLVMString
fn print_to_string(&self) -> LLVMString
Prints the definition of a Type to a LLVMString.
sourceimpl<'ctx> BasicType<'ctx> for ArrayType<'ctx>
impl<'ctx> BasicType<'ctx> for ArrayType<'ctx>
sourcefn as_basic_type_enum(&self) -> BasicTypeEnum<'ctx>
fn as_basic_type_enum(&self) -> BasicTypeEnum<'ctx>
Returns a BasicTypeEnum that represents the current type.
sourcefn 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>
Create a FunctionType with this BasicType as its return type. Read more
sourcefn 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 more
sourcefn 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 more
sourcefn array_type(&self, size: u32) -> ArrayType<'ctx>
fn array_type(&self, size: u32) -> ArrayType<'ctx>
Create an ArrayType with this BasicType as its elements. Read more
sourcefn ptr_type(&self, address_space: AddressSpace) -> PointerType<'ctx>
fn ptr_type(&self, address_space: AddressSpace) -> PointerType<'ctx>
Create a PointerType that points to this BasicType. Read more
sourceimpl<'ctx> From<ArrayType<'ctx>> for AnyTypeEnum<'ctx>
impl<'ctx> From<ArrayType<'ctx>> for AnyTypeEnum<'ctx>
sourcefn from(value: ArrayType<'_>) -> AnyTypeEnum<'_>
fn from(value: ArrayType<'_>) -> AnyTypeEnum<'_>
Converts to this type from the input type.
sourceimpl<'ctx> From<ArrayType<'ctx>> for BasicMetadataTypeEnum<'ctx>
impl<'ctx> From<ArrayType<'ctx>> for BasicMetadataTypeEnum<'ctx>
sourcefn from(value: ArrayType<'_>) -> BasicMetadataTypeEnum<'_>
fn from(value: ArrayType<'_>) -> BasicMetadataTypeEnum<'_>
Converts to this type from the input type.
sourceimpl<'ctx> From<ArrayType<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> From<ArrayType<'ctx>> for BasicTypeEnum<'ctx>
sourcefn from(value: ArrayType<'_>) -> BasicTypeEnum<'_>
fn from(value: ArrayType<'_>) -> BasicTypeEnum<'_>
Converts to this type from the input type.
sourceimpl<'ctx> PartialEq<ArrayType<'ctx>> for ArrayType<'ctx>
impl<'ctx> PartialEq<ArrayType<'ctx>> for ArrayType<'ctx>
sourceimpl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for ArrayType<'ctx>
impl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for ArrayType<'ctx>
sourceimpl<'ctx> TryFrom<BasicMetadataTypeEnum<'ctx>> for ArrayType<'ctx>
impl<'ctx> TryFrom<BasicMetadataTypeEnum<'ctx>> for ArrayType<'ctx>
sourceimpl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for ArrayType<'ctx>
impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for ArrayType<'ctx>
impl<'ctx> Copy for ArrayType<'ctx>
impl<'ctx> Eq for ArrayType<'ctx>
impl<'ctx> StructuralEq for ArrayType<'ctx>
impl<'ctx> StructuralPartialEq for ArrayType<'ctx>
Auto Trait Implementations
impl<'ctx> RefUnwindSafe for ArrayType<'ctx>
impl<'ctx> !Send for ArrayType<'ctx>
impl<'ctx> !Sync for ArrayType<'ctx>
impl<'ctx> Unpin for ArrayType<'ctx>
impl<'ctx> UnwindSafe for ArrayType<'ctx>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more