[][src]Struct inkwell::types::PointerType

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

A PointerType is the type of a pointer constant or variable.

Implementations

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

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

Gets the size of this PointerType. Value may vary depending on the target architecture.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let f32_ptr_type_size = f32_ptr_type.size_of();

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

Gets the alignment of this PointerType. Value may vary depending on the target architecture.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let f32_ptr_type_alignment = f32_ptr_type.get_alignment();

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

Creates a PointerType with this PointerType for its element type.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let f32_ptr_ptr_type = f32_ptr_type.ptr_type(AddressSpace::Generic);

assert_eq!(f32_ptr_ptr_type.get_element_type().into_pointer_type(), f32_ptr_type);

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

Gets a reference to the Context this PointerType was created in.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);

assert_eq!(*f32_ptr_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 PointerType for its return type.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let fn_type = f32_ptr_type.fn_type(&[], false);

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

Creates an ArrayType with this PointerType for its element type.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let f32_ptr_array_type = f32_ptr_type.array_type(3);

assert_eq!(f32_ptr_array_type.len(), 3);
assert_eq!(f32_ptr_array_type.get_element_type().into_pointer_type(), f32_ptr_type);

pub fn get_address_space(self) -> AddressSpace[src]

Gets the AddressSpace a PointerType was created with.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);

assert_eq!(f32_ptr_type.get_address_space(), AddressSpace::Generic);

pub fn const_null(self) -> PointerValue<'ctx>[src]

Creates a null PointerValue of this PointerType. It will be automatically assigned this PointerType's Context.

Example

use inkwell::AddressSpace;
use inkwell::context::Context;

// Local Context
let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let f32_ptr_null = f32_ptr_type.const_null();

assert!(f32_ptr_null.is_null());

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

Creates a constant null value of this PointerType. This is practically the same as calling const_null for this particular type and so this function may be removed in the future.

Example

use inkwell::AddressSpace;
use inkwell::context::Context;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let f32_ptr_zero = f32_ptr_type.const_zero();

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

Creates an undefined instance of a PointerType.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let f32_ptr_undef = f32_ptr_type.get_undef();

assert!(f32_ptr_undef.is_undef());

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

Creates a VectorType with this PointerType for its element type.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let f32_ptr_vec_type = f32_ptr_type.vec_type(3);

assert_eq!(f32_ptr_vec_type.get_size(), 3);
assert_eq!(f32_ptr_vec_type.get_element_type().into_pointer_type(), f32_ptr_type);

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

Gets the element type of this PointerType.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);

assert_eq!(f32_ptr_type.get_element_type().into_float_type(), f32_type);

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

Creates a constant ArrayValue.

Example

use inkwell::context::Context;
use inkwell::AddressSpace;

let context = Context::create();
let f32_type = context.f32_type();
let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic);
let f32_ptr_val = f32_ptr_type.const_null();
let f32_ptr_array = f32_ptr_type.const_array(&[f32_ptr_val, f32_ptr_val]);

assert!(f32_ptr_array.is_const());

Trait Implementations

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

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

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

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

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

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

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

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

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

impl<'ctx> PointerMathType<'ctx> for PointerType<'ctx>[src]

type ValueType = PointerValue<'ctx>

The value instance of a pointer type.

type PtrConvType = IntType<'ctx>

The type for pointer to int or pointer vector to int conversions.

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

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

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

type Error = ()

The type returned in the event of a conversion error.

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

type Error = ()

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'ctx> RefUnwindSafe for PointerType<'ctx>

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

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

impl<'ctx> Unpin for PointerType<'ctx>

impl<'ctx> UnwindSafe for PointerType<'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.