Struct inkwell::types::MetadataType

source ·
pub struct MetadataType<'ctx> { /* private fields */ }
Expand description

A MetadataType is the type of a metadata.

Implementations§

source§

impl<'ctx> MetadataType<'ctx>

source

pub unsafe fn new(metadata_type: LLVMTypeRef) -> Self

Available on crate features llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 or llvm13-0 or llvm14-0 or llvm15-0 or llvm16-0 or llvm17-0 or llvm18-0 only.

Create MetadataType from LLVMTypeRef

§Safety

Undefined behavior, if referenced type isn’t metadata type

source

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

Available on crate features llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 or llvm13-0 or llvm14-0 or llvm15-0 or llvm16-0 or llvm17-0 or llvm18-0 only.

Creates a FunctionType with this MetadataType for its return type.

§Example
use inkwell::context::Context;

let context = Context::create();
let md_type = context.metadata_type();
let fn_type = md_type.fn_type(&[], false);
source

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

Available on crate features llvm6-0 or llvm7-0 or llvm8-0 or llvm9-0 or llvm10-0 or llvm11-0 or llvm12-0 or llvm13-0 or llvm14-0 or llvm15-0 or llvm16-0 or llvm17-0 or llvm18-0 only.

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

§Example
use inkwell::context::Context;

let context = Context::create();
let md_type = context.metadata_type();

assert_eq!(md_type.get_context(), context);
source

pub fn print_to_string(self) -> LLVMString

Print the definition of a MetadataType to LLVMString.

Trait Implementations§

source§

impl AsTypeRef for MetadataType<'_>

source§

fn as_type_ref(&self) -> LLVMTypeRef

Returns the internal LLVM reference behind the type
source§

impl<'ctx> Clone for MetadataType<'ctx>

source§

fn clone(&self) -> MetadataType<'ctx>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'ctx> Debug for MetadataType<'ctx>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for MetadataType<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'ctx> From<MetadataType<'ctx>> for BasicMetadataTypeEnum<'ctx>

source§

fn from(value: MetadataType<'_>) -> BasicMetadataTypeEnum<'_>

Converts to this type from the input type.
source§

impl<'ctx> PartialEq for MetadataType<'ctx>

source§

fn eq(&self, other: &MetadataType<'ctx>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'ctx> TryFrom<BasicMetadataTypeEnum<'ctx>> for MetadataType<'ctx>

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: BasicMetadataTypeEnum<'ctx>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<'ctx> Copy for MetadataType<'ctx>

source§

impl<'ctx> Eq for MetadataType<'ctx>

source§

impl<'ctx> StructuralPartialEq for MetadataType<'ctx>

Auto Trait Implementations§

§

impl<'ctx> Freeze for MetadataType<'ctx>

§

impl<'ctx> RefUnwindSafe for MetadataType<'ctx>

§

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

§

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

§

impl<'ctx> Unpin for MetadataType<'ctx>

§

impl<'ctx> UnwindSafe for MetadataType<'ctx>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.