[][src]Struct inkwell::types::FunctionType

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

A FunctionType is the type of a function variable.

Implementations

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

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

Creates a PointerType with this FunctionType for its element type.

Example

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

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

assert_eq!(fn_ptr_type.get_element_type().into_function_type(), fn_type);

pub fn is_var_arg(self) -> bool[src]

Determines whether or not a FunctionType is a variadic function.

Example

use inkwell::context::Context;

let context = Context::create();
let f32_type = context.f32_type();
let fn_type = f32_type.fn_type(&[], true);

assert!(fn_type.is_var_arg());

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

Gets param types this FunctionType has.

Example

use inkwell::context::Context;

let context = Context::create();
let f32_type = context.f32_type();
let fn_type = f32_type.fn_type(&[f32_type.into()], true);
let param_types = fn_type.get_param_types();

assert_eq!(param_types.len(), 1);
assert_eq!(param_types[0].into_float_type(), f32_type);

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

Counts the number of param types this FunctionType has.

Example

use inkwell::context::Context;

let context = Context::create();
let f32_type = context.f32_type();
let fn_type = f32_type.fn_type(&[f32_type.into()], true);

assert_eq!(fn_type.count_param_types(), 1);

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

Gets whether or not this FunctionType is sized or not. This is likely always false and may be removed in the future.

Example

use inkwell::context::Context;

let context = Context::create();
let f32_type = context.f32_type();
let fn_type = f32_type.fn_type(&[], true);

assert!(!fn_type.is_sized());

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

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

Example

use inkwell::context::Context;

let context = Context::create();
let f32_type = context.f32_type();
let fn_type = f32_type.fn_type(&[], true);

assert_eq!(*fn_type.get_context(), context);

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

Gets the return type of this FunctionType.

Example

use inkwell::context::Context;

let context = Context::create();
let f32_type = context.f32_type();
let fn_type = f32_type.fn_type(&[], true);

assert_eq!(fn_type.get_return_type().unwrap().into_float_type(), f32_type);

Trait Implementations

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

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

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

impl<'_> Debug for FunctionType<'_>[src]

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

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

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

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

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

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

type Error = ()

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'ctx> RefUnwindSafe for FunctionType<'ctx>

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

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

impl<'ctx> Unpin for FunctionType<'ctx>

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