[][src]Trait inkwell::types::BasicType

pub trait BasicType<'ctx>: AnyType<'ctx> {
    pub fn as_basic_type_enum(&self) -> BasicTypeEnum<'ctx> { ... }
pub fn fn_type(
        &self,
        param_types: &[BasicTypeEnum<'ctx>],
        is_var_args: bool
    ) -> FunctionType<'ctx> { ... }
pub fn is_sized(&self) -> bool { ... }
pub fn size_of(&self) -> Option<IntValue<'ctx>> { ... }
pub fn array_type(&self, size: u32) -> ArrayType<'ctx> { ... }
pub fn ptr_type(&self, address_space: AddressSpace) -> PointerType<'ctx> { ... } }

Represents a basic LLVM type, that may be used in functions and struct definitions.

Provided methods

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

Returns a BasicTypeEnum that represents the current type.

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

Create a FunctionType with this BasicType as its return type.

Example:

use inkwell::context::Context;
use inkwell::types::BasicType;

let context = Context::create();
let int = context.i32_type();
let int_basic_type = int.as_basic_type_enum();
assert_eq!(int_basic_type.fn_type(&[], false), int.fn_type(&[], false));

pub fn is_sized(&self) -> bool[src]

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

Example

use inkwell::context::Context;
use inkwell::types::BasicType;

let context = Context::create();
let f32_type = context.f32_type();
let f32_vec_type = f32_type.vec_type(40);

assert!(f32_vec_type.is_sized());

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

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

Example

use inkwell::context::Context;
use inkwell::types::BasicType;

let context = Context::create();
let f32_type = context.f32_type();
let f32_basic_type = f32_type.as_basic_type_enum();
let f32_type_size = f32_basic_type.size_of();

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

Create an ArrayType with this BasicType as its elements.

Example:

use inkwell::context::Context;
use inkwell::types::BasicType;

let context = Context::create();
let int = context.i32_type();
let int_basic_type = int.as_basic_type_enum();
assert_eq!(int_basic_type.array_type(32), int.array_type(32));

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

Create a PointerType that points to this BasicType.

Example:

use inkwell::context::Context;
use inkwell::types::BasicType;
use inkwell::AddressSpace;

let context = Context::create();
let int = context.i32_type();
let int_basic_type = int.as_basic_type_enum();
let addr_space = AddressSpace::Generic;
assert_eq!(int_basic_type.ptr_type(addr_space), int.ptr_type(addr_space));
Loading content...

Implementors

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

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

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

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

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

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

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

Loading content...