Struct llvm_plugin_inkwell::types::PointerType
source · [−]pub struct PointerType<'ctx> { /* private fields */ }Expand description
A PointerType is the type of a pointer constant or variable.
Implementations
sourceimpl<'ctx> PointerType<'ctx>
impl<'ctx> PointerType<'ctx>
sourcepub fn size_of(self) -> IntValue<'ctx>
pub fn size_of(self) -> IntValue<'ctx>
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();sourcepub fn get_alignment(self) -> IntValue<'ctx>
pub fn get_alignment(self) -> IntValue<'ctx>
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();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 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);sourcepub fn get_context(self) -> ContextRef<'ctx>
pub fn get_context(self) -> ContextRef<'ctx>
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);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 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);sourcepub fn array_type(self, size: u32) -> ArrayType<'ctx>
pub fn array_type(self, size: u32) -> ArrayType<'ctx>
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);sourcepub fn get_address_space(self) -> AddressSpace
pub fn get_address_space(self) -> AddressSpace
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);sourcepub fn print_to_string(self) -> LLVMString
pub fn print_to_string(self) -> LLVMString
Print the definition of a PointerType to LLVMString.
sourcepub fn const_null(self) -> PointerValue<'ctx>
pub fn const_null(self) -> PointerValue<'ctx>
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());sourcepub fn const_zero(self) -> PointerValue<'ctx>
pub fn const_zero(self) -> PointerValue<'ctx>
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();sourcepub fn get_undef(self) -> PointerValue<'ctx>
pub fn get_undef(self) -> PointerValue<'ctx>
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());sourcepub fn vec_type(self, size: u32) -> VectorType<'ctx>
pub fn vec_type(self, size: u32) -> VectorType<'ctx>
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);sourcepub fn get_element_type(self) -> AnyTypeEnum<'ctx>
pub fn get_element_type(self) -> AnyTypeEnum<'ctx>
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);sourcepub fn const_array(self, values: &[PointerValue<'ctx>]) -> ArrayValue<'ctx>
pub fn const_array(self, values: &[PointerValue<'ctx>]) -> ArrayValue<'ctx>
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
sourceimpl<'ctx> AnyType<'ctx> for PointerType<'ctx>
impl<'ctx> AnyType<'ctx> for PointerType<'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 PointerType<'ctx>
impl<'ctx> BasicType<'ctx> for PointerType<'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> Clone for PointerType<'ctx>
impl<'ctx> Clone for PointerType<'ctx>
sourcefn clone(&self) -> PointerType<'ctx>
fn clone(&self) -> PointerType<'ctx>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<'ctx> Debug for PointerType<'ctx>
impl<'ctx> Debug for PointerType<'ctx>
sourceimpl Display for PointerType<'_>
impl Display for PointerType<'_>
sourceimpl<'ctx> From<PointerType<'ctx>> for AnyTypeEnum<'ctx>
impl<'ctx> From<PointerType<'ctx>> for AnyTypeEnum<'ctx>
sourcefn from(value: PointerType<'_>) -> AnyTypeEnum<'_>
fn from(value: PointerType<'_>) -> AnyTypeEnum<'_>
Converts to this type from the input type.
sourceimpl<'ctx> From<PointerType<'ctx>> for BasicMetadataTypeEnum<'ctx>
impl<'ctx> From<PointerType<'ctx>> for BasicMetadataTypeEnum<'ctx>
sourcefn from(value: PointerType<'_>) -> BasicMetadataTypeEnum<'_>
fn from(value: PointerType<'_>) -> BasicMetadataTypeEnum<'_>
Converts to this type from the input type.
sourceimpl<'ctx> From<PointerType<'ctx>> for BasicTypeEnum<'ctx>
impl<'ctx> From<PointerType<'ctx>> for BasicTypeEnum<'ctx>
sourcefn from(value: PointerType<'_>) -> BasicTypeEnum<'_>
fn from(value: PointerType<'_>) -> BasicTypeEnum<'_>
Converts to this type from the input type.
sourceimpl<'ctx> PartialEq<PointerType<'ctx>> for PointerType<'ctx>
impl<'ctx> PartialEq<PointerType<'ctx>> for PointerType<'ctx>
sourcefn eq(&self, other: &PointerType<'ctx>) -> bool
fn eq(&self, other: &PointerType<'ctx>) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourceimpl<'ctx> PointerMathType<'ctx> for PointerType<'ctx>
impl<'ctx> PointerMathType<'ctx> for PointerType<'ctx>
type ValueType = PointerValue<'ctx>
type ValueType = PointerValue<'ctx>
The value instance of a pointer type.
type PtrConvType = IntType<'ctx>
type PtrConvType = IntType<'ctx>
The type for pointer to int or pointer vector to int conversions.
sourceimpl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for PointerType<'ctx>
impl<'ctx> TryFrom<AnyTypeEnum<'ctx>> for PointerType<'ctx>
sourceimpl<'ctx> TryFrom<BasicMetadataTypeEnum<'ctx>> for PointerType<'ctx>
impl<'ctx> TryFrom<BasicMetadataTypeEnum<'ctx>> for PointerType<'ctx>
sourceimpl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for PointerType<'ctx>
impl<'ctx> TryFrom<BasicTypeEnum<'ctx>> for PointerType<'ctx>
impl<'ctx> Copy for PointerType<'ctx>
impl<'ctx> Eq for PointerType<'ctx>
impl<'ctx> StructuralEq for PointerType<'ctx>
impl<'ctx> StructuralPartialEq for PointerType<'ctx>
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
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