[][src]Struct inkwell::types::ArrayType

pub struct ArrayType<'ctx> { /* fields omitted */ }

An ArrayType is the type of contiguous constants or variables.

Implementations

impl<'ctx> ArrayType<'ctx>[src]

pub fn size_of(self) -> Option<IntValue<'ctx>>[src]

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();

pub fn get_alignment(self) -> IntValue<'ctx>[src]

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();

pub fn ptr_type(self, address_space: AddressSpace) -> PointerType<'ctx>[src]

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);

pub fn get_context(self) -> ContextRef<'ctx>[src]

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);

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

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);

pub fn array_type(self, size: u32) -> ArrayType<'ctx>[src]

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);

pub fn const_array(self, values: &[ArrayValue<'ctx>]) -> ArrayValue<'ctx>[src]

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());

pub fn const_zero(self) -> ArrayValue<'ctx>[src]

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();

pub fn len(self) -> u32[src]

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);

pub fn get_undef(self) -> ArrayValue<'ctx>[src]

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());

pub fn get_element_type(self) -> BasicTypeEnum<'ctx>[src]

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

impl<'ctx> AnyType<'ctx> for ArrayType<'ctx>[src]

impl<'ctx> BasicType<'ctx> for ArrayType<'ctx>[src]

impl<'ctx> Clone for ArrayType<'ctx>[src]

impl<'ctx> Copy for ArrayType<'ctx>[src]

impl<'ctx> Debug for ArrayType<'ctx>[src]

impl<'ctx> Eq for ArrayType<'ctx>[src]

impl<'ctx> From<ArrayType<'ctx>> for AnyTypeEnum<'ctx>[src]

impl<'ctx> From<ArrayType<'ctx>> for BasicTypeEnum<'ctx>[src]

impl<'ctx> PartialEq<ArrayType<'ctx>> for ArrayType<'ctx>[src]

impl<'ctx> StructuralEq for ArrayType<'ctx>[src]

impl<'ctx> StructuralPartialEq for ArrayType<'ctx>[src]

impl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for ArrayType<'ctx>[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for ArrayType<'ctx>[src]

type Error = ()

The type returned in the event of a conversion error.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.