edlang/inkwell/builder/struct.Builder.html

1311 lines
198 KiB
HTML
Raw Normal View History

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="All `build_*` methods return a `Result&lt;_, BuilderError&gt;` type containing either the returned value or some error. Those methods all may return `BuilderError::UnsetPosition` if a `position_*` method has not yet been called, in addition to any other possibility."><title>Builder in inkwell::builder - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="inkwell" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-feafe1bb7466e4bd.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../inkwell/index.html">inkwell</a><span class="version">0.4.0</span></h2></div><h2 class="location"><a href="#">Builder</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.as_mut_ptr">as_mut_ptr</a></li><li><a href="#method.build_address_space_cast">build_address_space_cast</a></li><li><a href="#method.build_aggregate_return">build_aggregate_return</a></li><li><a href="#method.build_alloca">build_alloca</a></li><li><a href="#method.build_and">build_and</a></li><li><a href="#method.build_array_alloca">build_array_alloca</a></li><li><a href="#method.build_array_malloc">build_array_malloc</a></li><li><a href="#method.build_atomicrmw">build_atomicrmw</a></li><li><a href="#method.build_bitcast">build_bitcast</a></li><li><a href="#method.build_call">build_call</a></li><li><a href="#method.build_cast">build_cast</a></li><li><a href="#method.build_cmpxchg">build_cmpxchg</a></li><li><a href="#method.build_conditional_branch">build_conditional_branch</a></li><li><a href="#method.build_direct_call">build_direct_call</a></li><li><a href="#method.build_direct_invoke">build_direct_invoke</a></li><li><a href="#method.build_extract_element">build_extract_element</a></li><li><a href="#method.build_extract_value">build_extract_value</a></li><li><a href="#method.build_fence">build_fence</a></li><li><a href="#method.build_float_add">build_float_add</a></li><li><a href="#method.build_float_cast">build_float_cast</a></li><li><a href="
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../inkwell/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../index.html">inkwell</a>::<wbr><a href="index.html">builder</a>::<wbr><a class="struct" href="#">Builder</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/inkwell/builder.rs.html#91-95">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct Builder&lt;'ctx&gt; { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>All <code>build_*</code> methods return a <code>Result&lt;_, BuilderError&gt;</code> type containing either the returned value or some error.
Those methods all may return <code>BuilderError::UnsetPosition</code> if a <code>position_*</code> method has not yet been called, in addition
to any other possibility.</p>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Builder%3C'ctx%3E" class="impl"><a class="src rightside" href="../../src/inkwell/builder.rs.html#100-3433">source</a><a href="#impl-Builder%3C'ctx%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'ctx&gt; <a class="struct" href="struct.Builder.html" title="struct inkwell::builder::Builder">Builder</a>&lt;'ctx&gt;</h3></section></summary><div class="impl-items"><section id="method.new" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#101-109">source</a><h4 class="code-header">pub unsafe fn <a href="#method.new" class="fn">new</a>(builder: <a class="type" href="../../llvm_sys/prelude/type.LLVMBuilderRef.html" title="type llvm_sys::prelude::LLVMBuilderRef">LLVMBuilderRef</a>) -&gt; Self</h4></section><details class="toggle method-toggle" open><summary><section id="method.as_mut_ptr" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#112-114">source</a><h4 class="code-header">pub fn <a href="#method.as_mut_ptr" class="fn">as_mut_ptr</a>(&amp;self) -&gt; <a class="type" href="../../llvm_sys/prelude/type.LLVMBuilderRef.html" title="type llvm_sys::prelude::LLVMBuilderRef">LLVMBuilderRef</a></h4></section></summary><div class="docblock"><p>Acquires the underlying raw pointer belonging to this <code>Builder</code> type.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_return" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#140-152">source</a><h4 class="code-header">pub fn <a href="#method.build_return" class="fn">build_return</a>(
&amp;self,
value: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;dyn <a class="trait" href="../values/trait.BasicValue.html" title="trait inkwell::values::BasicValue">BasicValue</a>&lt;'ctx&gt;&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds a function return instruction. It should be provided with <code>None</code> if the return type
is void otherwise <code>Some(&amp;value)</code> should be provided.</p>
<h5 id="example"><a href="#example">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="comment">// A simple function which returns its argument:
</span><span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"ret"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>arg_types = [i32_type.into()];
<span class="kw">let </span>fn_type = i32_type.fn_type(<span class="kw-2">&amp;</span>arg_types, <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"ret"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>i32_arg = fn_value.get_first_param().unwrap();
builder.position_at_end(entry);
builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>i32_arg)).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_aggregate_return" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#177-188">source</a><h4 class="code-header">pub fn <a href="#method.build_aggregate_return" class="fn">build_aggregate_return</a>(
&amp;self,
values: &amp;[<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;]
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds a function return instruction for a return type which is an aggregate type (ie structs and arrays).
It is not necessary to use this over <code>build_return</code> but may be more convenient to use.</p>
<h5 id="example-1"><a href="#example-1">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="comment">// This builds a simple function which returns a struct (tuple) of two ints.
</span><span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"ret"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>i32_three = i32_type.const_int(<span class="number">3</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>i32_seven = i32_type.const_int(<span class="number">7</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>struct_type = context.struct_type(<span class="kw-2">&amp;</span>[i32_type.into(), i32_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_type = struct_type.fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"ret"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
builder.position_at_end(entry);
builder.build_aggregate_return(<span class="kw-2">&amp;</span>[i32_three.into(), i32_seven.into()]).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_call" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#258-268">source</a><h4 class="code-header">pub fn <a href="#method.build_call" class="fn">build_call</a>(
&amp;self,
function: <a class="struct" href="../values/struct.FunctionValue.html" title="struct inkwell::values::FunctionValue">FunctionValue</a>&lt;'ctx&gt;,
args: &amp;[<a class="enum" href="../values/enum.BasicMetadataValueEnum.html" title="enum inkwell::values::BasicMetadataValueEnum">BasicMetadataValueEnum</a>&lt;'ctx&gt;],
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.CallSiteValue.html" title="struct inkwell::values::CallSiteValue">CallSiteValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds a function call instruction. Alias for <a href="struct.Builder.html#method.build_direct_call" title="method inkwell::builder::Builder::build_direct_call">Builder::build_direct_call</a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_direct_call" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#299-309">source</a><h4 class="code-header">pub fn <a href="#method.build_direct_call" class="fn">build_direct_call</a>(
&amp;self,
function: <a class="struct" href="../values/struct.FunctionValue.html" title="struct inkwell::values::FunctionValue">FunctionValue</a>&lt;'ctx&gt;,
args: &amp;[<a class="enum" href="../values/enum.BasicMetadataValueEnum.html" title="enum inkwell::values::BasicMetadataValueEnum">BasicMetadataValueEnum</a>&lt;'ctx&gt;],
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.CallSiteValue.html" title="struct inkwell::values::CallSiteValue">CallSiteValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds a function call instruction. The function being called is known at compile time. If
you want to call a function pointer, see <a href="struct.Builder.html#method.build_indirect_call" title="method inkwell::builder::Builder::build_indirect_call">Builder::build_indirect_call</a>.</p>
<h5 id="example-2"><a href="#example-2">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="comment">// A simple function which calls itself:
</span><span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"ret"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>fn_type = i32_type.fn_type(<span class="kw-2">&amp;</span>[i32_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"ret"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>i32_arg = fn_value.get_first_param().unwrap();
<span class="kw">let </span>md_string = context.metadata_string(<span class="string">"a metadata"</span>);
builder.position_at_end(entry);
<span class="kw">let </span>ret_val = builder.build_call(fn_value, <span class="kw-2">&amp;</span>[i32_arg.into(), md_string.into()], <span class="string">"call"</span>).unwrap()
.try_as_basic_value()
.left()
.unwrap();
builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>ret_val)).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_indirect_call" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#342-353">source</a><h4 class="code-header">pub fn <a href="#method.build_indirect_call" class="fn">build_indirect_call</a>(
&amp;self,
function_type: <a class="struct" href="../types/struct.FunctionType.html" title="struct inkwell::types::FunctionType">FunctionType</a>&lt;'ctx&gt;,
function_pointer: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
args: &amp;[<a class="enum" href="../values/enum.BasicMetadataValueEnum.html" title="enum inkwell::values::BasicMetadataValueEnum">BasicMetadataValueEnum</a>&lt;'ctx&gt;],
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.CallSiteValue.html" title="struct inkwell::values::CallSiteValue">CallSiteValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Call a function pointer. Because a pointer does not carry a type, the type of the function
must be specified explicitly.</p>
<p>See <a href="../context/struct.Context.html#method.create_inline_asm" title="method inkwell::context::Context::create_inline_asm">Context::create_inline_asm</a> for a practical example. Basic usage looks like this:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="comment">// A simple function which calls itself:
</span><span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"ret"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>fn_type = i32_type.fn_type(<span class="kw-2">&amp;</span>[i32_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"ret"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>i32_arg = fn_value.get_first_param().unwrap();
<span class="kw">let </span>md_string = context.metadata_string(<span class="string">"a metadata"</span>);
builder.position_at_end(entry);
<span class="kw">let </span>function_pointer = fn_value.as_global_value().as_pointer_value();
<span class="kw">let </span>ret_val = builder.build_indirect_call(fn_value.get_type(), function_pointer, <span class="kw-2">&amp;</span>[i32_arg.into(), md_string.into()], <span class="string">"call"</span>).unwrap()
.try_as_basic_value()
.left()
.unwrap();
builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>ret_val)).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_invoke" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#589-601">source</a><h4 class="code-header">pub fn <a href="#method.build_invoke" class="fn">build_invoke</a>(
&amp;self,
function: <a class="struct" href="../values/struct.FunctionValue.html" title="struct inkwell::values::FunctionValue">FunctionValue</a>&lt;'ctx&gt;,
args: &amp;[<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;],
then_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;,
catch_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.CallSiteValue.html" title="struct inkwell::values::CallSiteValue">CallSiteValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>An invoke is similar to a normal function call, but used to
call functions that may throw an exception, and then respond to the exception.</p>
<p>When the called function returns normally, the <code>then</code> block is evaluated next. If instead
the function threw an exception, the <code>catch</code> block is entered. The first non-phi
instruction of the catch block must be a <code>landingpad</code> instruction. See also
<a href="struct.Builder.html#method.build_landing_pad" title="method inkwell::builder::Builder::build_landing_pad"><code>Builder::build_landing_pad</code></a>.</p>
<p>The <a href="crate::passes::PassManager::add_prune_eh_pass"><code>add_prune_eh_pass</code></a> turns an invoke into a call when the called function is
guaranteed to never throw an exception.</p>
<p>This example catches C++ exceptions of type <code>int</code>, and returns <code>0</code> if an exceptions is thrown.
For usage of a cleanup landing pad and the <code>resume</code> instruction, see <a href="struct.Builder.html#method.build_resume" title="method inkwell::builder::Builder::build_resume"><code>Builder::build_resume</code></a></p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::AddressSpace;
<span class="kw">use </span>inkwell::module::Linkage;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"sum"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>f32_type = context.f32_type();
<span class="kw">let </span>fn_type = f32_type.fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>);
<span class="comment">// we will pretend this function can throw an exception
</span><span class="kw">let </span>function = module.add_function(<span class="string">"bomb"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>basic_block = context.append_basic_block(function, <span class="string">"entry"</span>);
builder.position_at_end(basic_block);
<span class="kw">let </span>pi = f32_type.const_float(::std::f64::consts::PI);
builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>pi)).unwrap();
<span class="kw">let </span>function2 = module.add_function(<span class="string">"wrapper"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>basic_block2 = context.append_basic_block(function2, <span class="string">"entry"</span>);
builder.position_at_end(basic_block2);
<span class="kw">let </span>then_block = context.append_basic_block(function2, <span class="string">"then_block"</span>);
<span class="kw">let </span>catch_block = context.append_basic_block(function2, <span class="string">"catch_block"</span>);
<span class="kw">let </span>call_site = builder.build_invoke(function, <span class="kw-2">&amp;</span>[], then_block, catch_block, <span class="string">"get_pi"</span>).unwrap();
{
builder.position_at_end(then_block);
<span class="comment">// in the then_block, the `call_site` value is defined and can be used
</span><span class="kw">let </span>result = call_site.try_as_basic_value().left().unwrap();
builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>result)).unwrap();
}
{
builder.position_at_end(catch_block);
<span class="comment">// the personality function used by C++
</span><span class="kw">let </span>personality_function = {
<span class="kw">let </span>name = <span class="string">"__gxx_personality_v0"</span>;
<span class="kw">let </span>linkage = <span class="prelude-val">Some</span>(Linkage::External);
module.add_function(name, context.i64_type().fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>), linkage)
};
<span class="comment">// type of an exception in C++
</span><span class="kw">let </span>i8_ptr_type = context.i32_type().ptr_type(AddressSpace::default());
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>exception_type = context.struct_type(<span class="kw-2">&amp;</span>[i8_ptr_type.into(), i32_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>null = i8_ptr_type.const_zero();
<span class="kw">let </span>res = builder.build_landing_pad(exception_type, personality_function, <span class="kw-2">&amp;</span>[null.into()], <span class="bool-val">false</span>, <span class="string">"res"</span>).unwrap();
<span class="comment">// we handle the exception by returning a default value
</span>builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>f32_type.const_zero())).unwrap();
}</code></pre></div>
</div></details><section id="method.build_direct_invoke" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#604-623">source</a><h4 class="code-header">pub fn <a href="#method.build_direct_invoke" class="fn">build_direct_invoke</a>(
&amp;self,
function: <a class="struct" href="../values/struct.FunctionValue.html" title="struct inkwell::values::FunctionValue">FunctionValue</a>&lt;'ctx&gt;,
args: &amp;[<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;],
then_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;,
catch_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.CallSiteValue.html" title="struct inkwell::values::CallSiteValue">CallSiteValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_indirect_invoke" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#626-646">source</a><h4 class="code-header">pub fn <a href="#method.build_indirect_invoke" class="fn">build_indirect_invoke</a>(
&amp;self,
function_type: <a class="struct" href="../types/struct.FunctionType.html" title="struct inkwell::types::FunctionType">FunctionType</a>&lt;'ctx&gt;,
function_pointer: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
args: &amp;[<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;],
then_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;,
catch_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.CallSiteValue.html" title="struct inkwell::values::CallSiteValue">CallSiteValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><details class="toggle method-toggle" open><summary><section id="method.build_landing_pad" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#824-862">source</a><h4 class="code-header">pub fn <a href="#method.build_landing_pad" class="fn">build_landing_pad</a>&lt;T&gt;(
&amp;self,
exception_type: T,
personality_function: <a class="struct" href="../values/struct.FunctionValue.html" title="struct inkwell::values::FunctionValue">FunctionValue</a>&lt;'ctx&gt;,
clauses: &amp;[<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;],
is_cleanup: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;<div class="where">where
T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;,</div></h4></section></summary><div class="docblock"><p>Landing pads are places where control flow jumps to if a <a href="struct.Builder.html#method.build_invoke" title="method inkwell::builder::Builder::build_invoke"><code>Builder::build_invoke</code></a> triggered an exception.
The landing pad will match the exception against its <em>clauses</em>. Depending on the clause
that is matched, the exception can then be handled, or resumed after some optional cleanup,
causing the exception to bubble up.</p>
<p>Exceptions in LLVM are designed based on the needs of a C++ compiler, but can be used more generally.
Here are some specific examples of landing pads. For a full example of handling an exception, see <a href="struct.Builder.html#method.build_invoke" title="method inkwell::builder::Builder::build_invoke"><code>Builder::build_invoke</code></a>.</p>
<ul>
<li><strong>cleanup</strong>: a cleanup landing pad is always visited when unwinding the stack.
A cleanup is extra code that needs to be run when unwinding a scope. C++ destructors are a typical example.
In a language with reference counting, the cleanup block can decrement the refcount of values in scope.
The <a href="struct.Builder.html#method.build_resume" title="method inkwell::builder::Builder::build_resume"><code>Builder::build_resume</code></a> function has a full example using a cleanup lading pad.</li>
</ul>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::AddressSpace;
<span class="kw">use </span>inkwell::module::Linkage;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"sum"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="comment">// type of an exception in C++
</span><span class="kw">let </span>i8_ptr_type = context.i8_type().ptr_type(AddressSpace::default());
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>exception_type = context.struct_type(<span class="kw-2">&amp;</span>[i8_ptr_type.into(), i32_type.into()], <span class="bool-val">false</span>);
<span class="comment">// the personality function used by C++
</span><span class="kw">let </span>personality_function = {
<span class="kw">let </span>name = <span class="string">"__gxx_personality_v0"</span>;
<span class="kw">let </span>linkage = <span class="prelude-val">Some</span>(Linkage::External);
module.add_function(name, context.i64_type().fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>), linkage)
};
<span class="comment">// make the cleanup landing pad
</span><span class="kw">let </span>res = builder.build_landing_pad( exception_type, personality_function, <span class="kw-2">&amp;</span>[], <span class="bool-val">true</span>, <span class="string">"res"</span>).unwrap();</code></pre></div>
<ul>
<li><strong>catch all</strong>: An implementation of the C++ <code>catch(...)</code>, which catches all exceptions.
A catch clause with a NULL pointer value will match anything.</li>
</ul>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::AddressSpace;
<span class="kw">use </span>inkwell::module::Linkage;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"sum"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="comment">// type of an exception in C++
</span><span class="kw">let </span>i8_ptr_type = context.i8_type().ptr_type(AddressSpace::default());
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>exception_type = context.struct_type(<span class="kw-2">&amp;</span>[i8_ptr_type.into(), i32_type.into()], <span class="bool-val">false</span>);
<span class="comment">// the personality function used by C++
</span><span class="kw">let </span>personality_function = {
<span class="kw">let </span>name = <span class="string">"__gxx_personality_v0"</span>;
<span class="kw">let </span>linkage = <span class="prelude-val">Some</span>(Linkage::External);
module.add_function(name, context.i64_type().fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>), linkage)
};
<span class="comment">// make a null pointer of type i8
</span><span class="kw">let </span>null = i8_ptr_type.const_zero();
<span class="comment">// make the catch all landing pad
</span><span class="kw">let </span>res = builder.build_landing_pad(exception_type, personality_function, <span class="kw-2">&amp;</span>[null.into()], <span class="bool-val">false</span>, <span class="string">"res"</span>).unwrap();</code></pre></div>
<ul>
<li><strong>catch a type of exception</strong>: Catch a specific type of exception. The example uses C++s type info.</li>
</ul>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::module::Linkage;
<span class="kw">use </span>inkwell::AddressSpace;
<span class="kw">use </span>inkwell::values::BasicValue;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"sum"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="comment">// type of an exception in C++
</span><span class="kw">let </span>i8_ptr_type = context.i8_type().ptr_type(AddressSpace::default());
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>exception_type = context.struct_type(<span class="kw-2">&amp;</span>[i8_ptr_type.into(), i32_type.into()], <span class="bool-val">false</span>);
<span class="comment">// the personality function used by C++
</span><span class="kw">let </span>personality_function = {
<span class="kw">let </span>name = <span class="string">"__gxx_personality_v0"</span>;
<span class="kw">let </span>linkage = <span class="prelude-val">Some</span>(Linkage::External);
module.add_function(name, context.i64_type().fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>), linkage)
};
<span class="comment">// link in the C++ type info for the `int` type
</span><span class="kw">let </span>type_info_int = module.add_global(i8_ptr_type, <span class="prelude-val">Some</span>(AddressSpace::default()), <span class="string">"_ZTIi"</span>);
type_info_int.set_linkage(Linkage::External);
<span class="comment">// make the catch landing pad
</span><span class="kw">let </span>clause = type_info_int.as_basic_value_enum();
<span class="kw">let </span>res = builder.build_landing_pad(exception_type, personality_function, <span class="kw-2">&amp;</span>[clause], <span class="bool-val">false</span>, <span class="string">"res"</span>).unwrap();</code></pre></div>
<ul>
<li><strong>filter</strong>: A filter clause encodes that only some types of exceptions are valid at this
point. A filter clause is made by constructing a clause from a constant array.</li>
</ul>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::module::Linkage;
<span class="kw">use </span>inkwell::values::AnyValue;
<span class="kw">use </span>inkwell::AddressSpace;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"sum"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="comment">// type of an exception in C++
</span><span class="kw">let </span>i8_ptr_type = context.i8_type().ptr_type(AddressSpace::default());
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>exception_type = context.struct_type(<span class="kw-2">&amp;</span>[i8_ptr_type.into(), i32_type.into()], <span class="bool-val">false</span>);
<span class="comment">// the personality function used by C++
</span><span class="kw">let </span>personality_function = {
<span class="kw">let </span>name = <span class="string">"__gxx_personality_v0"</span>;
<span class="kw">let </span>linkage = <span class="prelude-val">Some</span>(Linkage::External);
module.add_function(name, context.i64_type().fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>), linkage)
};
<span class="comment">// link in the C++ type info for the `int` type
</span><span class="kw">let </span>type_info_int = module.add_global(i8_ptr_type, <span class="prelude-val">Some</span>(AddressSpace::default()), <span class="string">"_ZTIi"</span>);
type_info_int.set_linkage(Linkage::External);
<span class="comment">// make the filter landing pad
</span><span class="kw">let </span>filter_pattern = i8_ptr_type.const_array(<span class="kw-2">&amp;</span>[type_info_int.as_any_value_enum().into_pointer_value()]);
<span class="kw">let </span>res = builder.build_landing_pad(exception_type, personality_function, <span class="kw-2">&amp;</span>[filter_pattern.into()], <span class="bool-val">false</span>, <span class="string">"res"</span>).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_resume" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#935-942">source</a><h4 class="code-header">pub fn <a href="#method.build_resume" class="fn">build_resume</a>&lt;V: <a class="trait" href="../values/trait.BasicValue.html" title="trait inkwell::values::BasicValue">BasicValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
value: V
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Resume propagation of an existing (in-flight) exception whose unwinding was interrupted with a landingpad instruction.</p>
<p>This example uses a cleanup landing pad. A cleanup is extra code that needs to be run when
unwinding a scope. C++ destructors are a typical example. In a language with reference counting,
the cleanup block can decrement the refcount of values in scope.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::AddressSpace;
<span class="kw">use </span>inkwell::module::Linkage;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"sum"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>f32_type = context.f32_type();
<span class="kw">let </span>fn_type = f32_type.fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>);
<span class="comment">// we will pretend this function can throw an exception
</span><span class="kw">let </span>function = module.add_function(<span class="string">"bomb"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>basic_block = context.append_basic_block(function, <span class="string">"entry"</span>);
builder.position_at_end(basic_block);
<span class="kw">let </span>pi = f32_type.const_float(::std::f64::consts::PI);
builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>pi)).unwrap();
<span class="kw">let </span>function2 = module.add_function(<span class="string">"wrapper"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>basic_block2 = context.append_basic_block(function2, <span class="string">"entry"</span>);
builder.position_at_end(basic_block2);
<span class="kw">let </span>then_block = context.append_basic_block(function2, <span class="string">"then_block"</span>);
<span class="kw">let </span>catch_block = context.append_basic_block(function2, <span class="string">"catch_block"</span>);
<span class="kw">let </span>call_site = builder.build_invoke(function, <span class="kw-2">&amp;</span>[], then_block, catch_block, <span class="string">"get_pi"</span>).unwrap();
{
builder.position_at_end(then_block);
<span class="comment">// in the then_block, the `call_site` value is defined and can be used
</span><span class="kw">let </span>result = call_site.try_as_basic_value().left().unwrap();
builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>result)).unwrap();
}
{
builder.position_at_end(catch_block);
<span class="comment">// the personality function used by C++
</span><span class="kw">let </span>personality_function = {
<span class="kw">let </span>name = <span class="string">"__gxx_personality_v0"</span>;
<span class="kw">let </span>linkage = <span class="prelude-val">Some</span>(Linkage::External);
module.add_function(name, context.i64_type().fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>), linkage)
};
<span class="comment">// type of an exception in C++
</span><span class="kw">let </span>i8_ptr_type = context.i32_type().ptr_type(AddressSpace::default());
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>exception_type = context.struct_type(<span class="kw-2">&amp;</span>[i8_ptr_type.into(), i32_type.into()], <span class="bool-val">false</span>);
<span class="comment">// make the landing pad; must give a concrete type to the slice
</span><span class="kw">let </span>res = builder.build_landing_pad( exception_type, personality_function, <span class="kw-2">&amp;</span>[], <span class="bool-val">true</span>, <span class="string">"res"</span>).unwrap();
<span class="comment">// do cleanup ...
</span>builder.build_resume(res).unwrap();
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_gep" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#974-998">source</a><h4 class="code-header">pub unsafe fn <a href="#method.build_gep" class="fn">build_gep</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
pointee_ty: T,
ptr: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
ordered_indexes: &amp;[<a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;],
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>GEP is very likely to segfault if indexes are used incorrectly, and is therefore an unsafe function. Maybe we can change this in the future.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_in_bounds_gep" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1032-1056">source</a><h4 class="code-header">pub unsafe fn <a href="#method.build_in_bounds_gep" class="fn">build_in_bounds_gep</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
pointee_ty: T,
ptr: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
ordered_indexes: &amp;[<a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;],
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>GEP is very likely to segfault if indexes are used incorrectly, and is therefore an unsafe function. Maybe we can change this in the future.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_struct_gep" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1155-1190">source</a><h4 class="code-header">pub fn <a href="#method.build_struct_gep" class="fn">build_struct_gep</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
pointee_ty: T,
ptr: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
index: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds a GEP instruction on a struct pointer. Returns <code>Err</code> <code>BuilderError::GEPPointee</code> or <code>BuilderError::GEPIndex</code> if input <code>PointerValue</code> doesnt
point to a struct or if index is out of bounds.</p>
<h5 id="example-3"><a href="#example-3">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::AddressSpace;
<span class="kw">use </span>inkwell::context::Context;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>module = context.create_module(<span class="string">"struct_gep"</span>);
<span class="kw">let </span>void_type = context.void_type();
<span class="kw">let </span>i32_ty = context.i32_type();
<span class="kw">let </span>i32_ptr_ty = i32_ty.ptr_type(AddressSpace::default());
<span class="kw">let </span>field_types = <span class="kw-2">&amp;</span>[i32_ty.into(), i32_ty.into()];
<span class="kw">let </span>struct_ty = context.struct_type(field_types, <span class="bool-val">false</span>);
<span class="kw">let </span>struct_ptr_ty = struct_ty.ptr_type(AddressSpace::default());
<span class="kw">let </span>fn_type = void_type.fn_type(<span class="kw-2">&amp;</span>[i32_ptr_ty.into(), struct_ptr_ty.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">""</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
builder.position_at_end(entry);
<span class="kw">let </span>i32_ptr = fn_value.get_first_param().unwrap().into_pointer_value();
<span class="kw">let </span>struct_ptr = fn_value.get_last_param().unwrap().into_pointer_value();
<span class="macro">assert!</span>(builder.build_struct_gep(i32_ty, i32_ptr, <span class="number">0</span>, <span class="string">"struct_gep"</span>).is_err());
<span class="macro">assert!</span>(builder.build_struct_gep(i32_ty, i32_ptr, <span class="number">10</span>, <span class="string">"struct_gep"</span>).is_err());
<span class="macro">assert!</span>(builder.build_struct_gep(struct_ty, struct_ptr, <span class="number">0</span>, <span class="string">"struct_gep"</span>).is_ok());
<span class="macro">assert!</span>(builder.build_struct_gep(struct_ty, struct_ptr, <span class="number">1</span>, <span class="string">"struct_gep"</span>).is_ok());
<span class="macro">assert!</span>(builder.build_struct_gep(struct_ty, struct_ptr, <span class="number">2</span>, <span class="string">"struct_gep"</span>).is_err());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_ptr_diff" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1266-1289">source</a><h4 class="code-header">pub fn <a href="#method.build_ptr_diff" class="fn">build_ptr_diff</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
pointee_ty: T,
lhs_ptr: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
rhs_ptr: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds an instruction which calculates the difference of two pointers.</p>
<h5 id="example-4"><a href="#example-4">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::AddressSpace;
<span class="comment">// Builds a function which diffs two pointers
</span><span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"ret"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>void_type = context.void_type();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>i32_ptr_type = i32_type.ptr_type(AddressSpace::default());
<span class="kw">let </span>fn_type = void_type.fn_type(<span class="kw-2">&amp;</span>[i32_ptr_type.into(), i32_ptr_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"ret"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>i32_ptr_param1 = fn_value.get_first_param().unwrap().into_pointer_value();
<span class="kw">let </span>i32_ptr_param2 = fn_value.get_nth_param(<span class="number">1</span>).unwrap().into_pointer_value();
builder.position_at_end(entry);
builder.build_ptr_diff(i32_ptr_type, i32_ptr_param1, i32_ptr_param2, <span class="string">"diff"</span>).unwrap();
builder.build_return(<span class="prelude-val">None</span>).unwrap();</code></pre></div>
</div></details><section id="method.build_phi" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1296-1304">source</a><h4 class="code-header">pub fn <a href="#method.build_phi" class="fn">build_phi</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
type_: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PhiValue.html" title="struct inkwell::values::PhiValue">PhiValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><details class="toggle method-toggle" open><summary><section id="method.build_store" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1331-1342">source</a><h4 class="code-header">pub fn <a href="#method.build_store" class="fn">build_store</a>&lt;V: <a class="trait" href="../values/trait.BasicValue.html" title="trait inkwell::values::BasicValue">BasicValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
ptr: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
value: V
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds a store instruction. It allows you to store a value of type <code>T</code> in a pointer to a type <code>T</code>.</p>
<h5 id="example-5"><a href="#example-5">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::AddressSpace;
<span class="comment">// Builds a function which takes an i32 pointer and stores a 7 in it.
</span><span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"ret"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>void_type = context.void_type();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>i32_ptr_type = i32_type.ptr_type(AddressSpace::default());
<span class="kw">let </span>i32_seven = i32_type.const_int(<span class="number">7</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>fn_type = void_type.fn_type(<span class="kw-2">&amp;</span>[i32_ptr_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"ret"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>i32_ptr_param = fn_value.get_first_param().unwrap().into_pointer_value();
builder.position_at_end(entry);
builder.build_store(i32_ptr_param, i32_seven).unwrap();
builder.build_return(<span class="prelude-val">None</span>).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_load" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1407-1428">source</a><h4 class="code-header">pub fn <a href="#method.build_load" class="fn">build_load</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
pointee_ty: T,
ptr: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds a load2 instruction. It allows you to retrieve a value of type <code>T</code> from a pointer to a type <code>T</code>.</p>
<h5 id="example-6"><a href="#example-6">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::AddressSpace;
<span class="comment">// Builds a function which takes an i32 pointer and returns the pointed at i32.
</span><span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"ret"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>i32_ptr_type = i32_type.ptr_type(AddressSpace::default());
<span class="kw">let </span>fn_type = i32_type.fn_type(<span class="kw-2">&amp;</span>[i32_ptr_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"ret"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>i32_ptr_param = fn_value.get_first_param().unwrap().into_pointer_value();
builder.position_at_end(entry);
<span class="kw">let </span>pointee = builder.build_load(i32_type, i32_ptr_param, <span class="string">"load2"</span>).unwrap();
builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>pointee)).unwrap();</code></pre></div>
</div></details><section id="method.build_alloca" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1431-1439">source</a><h4 class="code-header">pub fn <a href="#method.build_alloca" class="fn">build_alloca</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
ty: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_array_alloca" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1442-1456">source</a><h4 class="code-header">pub fn <a href="#method.build_array_alloca" class="fn">build_array_alloca</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
ty: T,
size: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><details class="toggle method-toggle" open><summary><section id="method.build_memcpy" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1469-1504">source</a><h4 class="code-header">pub fn <a href="#method.build_memcpy" class="fn">build_memcpy</a>(
&amp;self,
dest: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
dest_align_bytes: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>,
src: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
src_align_bytes: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>,
size: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Build a <a href="https://llvm.org/docs/LangRef.html#llvm-memcpy-intrinsic">memcpy</a> instruction.</p>
<p>Alignment arguments are specified in bytes, and should always be
both a power of 2 and under 2^64.</p>
<p>The final argument should be a pointer-sized integer.</p>
<p>Returns an <code>Err(BuilderError::AlignmentError)</code> if the source or destination alignments are not a power of 2.</p>
<p><a href="https://thedan64.github.io/inkwell/inkwell/targets/struct.TargetData.html#method.ptr_sized_int_type_in_context"><code>TargetData::ptr_sized_int_type_in_context</code></a> will get you one of those.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_memmove" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1517-1552">source</a><h4 class="code-header">pub fn <a href="#method.build_memmove" class="fn">build_memmove</a>(
&amp;self,
dest: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
dest_align_bytes: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>,
src: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
src_align_bytes: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>,
size: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Build a <a href="http://llvm.org/docs/LangRef.html#llvm-memmove-intrinsic">memmove</a> instruction.</p>
<p>Alignment arguments are specified in bytes, and should always be
both a power of 2 and under 2^64.</p>
<p>The final argument should be a pointer-sized integer.</p>
<p>Returns an <code>Err(BuilderError::AlignmentError)</code> if the source or destination alignments are not a power of 2 under 2^64.</p>
<p><a href="https://thedan64.github.io/inkwell/inkwell/targets/struct.TargetData.html#method.ptr_sized_int_type_in_context"><code>TargetData::ptr_sized_int_type_in_context</code></a> will get you one of those.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_memset" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1565-1592">source</a><h4 class="code-header">pub fn <a href="#method.build_memset" class="fn">build_memset</a>(
&amp;self,
dest: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
dest_align_bytes: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>,
val: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;,
size: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Build a <a href="http://llvm.org/docs/LangRef.html#llvm-memset-intrinsics">memset</a> instruction.</p>
<p>Alignment arguments are specified in bytes, and should always be
both a power of 2 and under 2^64.</p>
<p>The final argument should be a pointer-sized integer.</p>
<p>Returns an <code>Err(BuilderError::AlignmentError)</code> if the source alignment is not a power of 2 under 2^64.</p>
<p><a href="https://thedan64.github.io/inkwell/inkwell/targets/struct.TargetData.html#method.ptr_sized_int_type_in_context"><code>TargetData::ptr_sized_int_type_in_context</code></a> will get you one of those.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_malloc" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1596-1612">source</a><h4 class="code-header">pub fn <a href="#method.build_malloc" class="fn">build_malloc</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
ty: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Returns <code>Err(BuilderError::AlignmentError)</code> if the type is unsized.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_array_malloc" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1616-1638">source</a><h4 class="code-header">pub fn <a href="#method.build_array_malloc" class="fn">build_array_malloc</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
ty: T,
size: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Returns <code>Err(BuilderError::AlignmentError)</code> if the type is unsized.</p>
</div></details><section id="method.build_free" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1641-1646">source</a><h4 class="code-header">pub fn <a href="#method.build_free" class="fn">build_free</a>(
&amp;self,
ptr: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.insert_instruction" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1648-1659">source</a><h4 class="code-header">pub fn <a href="#method.insert_instruction" class="fn">insert_instruction</a>(
&amp;self,
instruction: &amp;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;,
name: <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>&gt;
)</h4></section><section id="method.get_insert_block" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1661-1663">source</a><h4 class="code-header">pub fn <a href="#method.get_insert_block" class="fn">get_insert_block</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;&gt;</h4></section><section id="method.build_int_unsigned_div" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1668-1676">source</a><h4 class="code-header">pub fn <a href="#method.build_int_unsigned_div" class="fn">build_int_unsigned_div</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_signed_div" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1680-1688">source</a><h4 class="code-header">pub fn <a href="#method.build_int_signed_div" class="fn">build_int_signed_div</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_exact_signed_div" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1692-1706">source</a><h4 class="code-header">pub fn <a href="#method.build_int_exact_signed_div" class="fn">build_int_exact_signed_div</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_unsigned_rem" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1710-1718">source</a><h4 class="code-header">pub fn <a href="#method.build_int_unsigned_rem" class="fn">build_int_unsigned_rem</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_signed_rem" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1722-1730">source</a><h4 class="code-header">pub fn <a href="#method.build_int_signed_rem" class="fn">build_int_signed_rem</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_s_extend" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1732-1752">source</a><h4 class="code-header">pub fn <a href="#method.build_int_s_extend" class="fn">build_int_s_extend</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int_value: T,
int_type: T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_address_space_cast" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1755-1775">source</a><h4 class="code-header">pub fn <a href="#method.build_address_space_cast" class="fn">build_address_space_cast</a>(
&amp;self,
ptr_val: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
ptr_type: <a class="struct" href="../types/struct.PointerType.html" title="struct inkwell::types::PointerType">PointerType</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><details class="toggle method-toggle" open><summary><section id="method.build_bitcast" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1805-1817">source</a><h4 class="code-header">pub fn <a href="#method.build_bitcast" class="fn">build_bitcast</a>&lt;T, V&gt;(
&amp;self,
val: V,
ty: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;<div class="where">where
T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;,
V: <a class="trait" href="../values/trait.BasicValue.html" title="trait inkwell::values::BasicValue">BasicValue</a>&lt;'ctx&gt;,</div></h4></section></summary><div class="docblock"><p>Builds a bitcast instruction. A bitcast reinterprets the bits of one value
into a value of another type which has the same bit width.</p>
<h5 id="example-7"><a href="#example-7">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::AddressSpace;
<span class="kw">use </span>inkwell::context::Context;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"bc"</span>);
<span class="kw">let </span>void_type = context.void_type();
<span class="kw">let </span>f32_type = context.f32_type();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>arg_types = [i32_type.into()];
<span class="kw">let </span>fn_type = void_type.fn_type(<span class="kw-2">&amp;</span>arg_types, <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"bc"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>i32_arg = fn_value.get_first_param().unwrap();
builder.position_at_end(entry);
builder.build_bitcast(i32_arg, f32_type, <span class="string">"i32tof32"</span>).unwrap();
builder.build_return(<span class="prelude-val">None</span>).unwrap();
<span class="macro">assert!</span>(module.verify().is_ok());</code></pre></div>
</div></details><section id="method.build_int_s_extend_or_bit_cast" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1819-1839">source</a><h4 class="code-header">pub fn <a href="#method.build_int_s_extend_or_bit_cast" class="fn">build_int_s_extend_or_bit_cast</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int_value: T,
int_type: T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_z_extend" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1841-1861">source</a><h4 class="code-header">pub fn <a href="#method.build_int_z_extend" class="fn">build_int_z_extend</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int_value: T,
int_type: T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_z_extend_or_bit_cast" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1863-1883">source</a><h4 class="code-header">pub fn <a href="#method.build_int_z_extend_or_bit_cast" class="fn">build_int_z_extend_or_bit_cast</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int_value: T,
int_type: T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_truncate" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1885-1906">source</a><h4 class="code-header">pub fn <a href="#method.build_int_truncate" class="fn">build_int_truncate</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int_value: T,
int_type: T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_truncate_or_bit_cast" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1908-1929">source</a><h4 class="code-header">pub fn <a href="#method.build_int_truncate_or_bit_cast" class="fn">build_int_truncate_or_bit_cast</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int_value: T,
int_type: T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_rem" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1931-1939">source</a><h4 class="code-header">pub fn <a href="#method.build_float_rem" class="fn">build_float_rem</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_to_unsigned_int" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1942-1963">source</a><h4 class="code-header">pub fn <a href="#method.build_float_to_unsigned_int" class="fn">build_float_to_unsigned_int</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
float: T,
int_type: &lt;T::<a class="associatedtype" href="../values/trait.FloatMathValue.html#associatedtype.BaseType" title="type inkwell::values::FloatMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.FloatMathType.html" title="trait inkwell::types::FloatMathType">FloatMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.FloatMathType.html#associatedtype.MathConvType" title="type inkwell::types::FloatMathType::MathConvType">MathConvType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&lt;T::<a class="associatedtype" href="../values/trait.FloatMathValue.html#associatedtype.BaseType" title="type inkwell::values::FloatMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.FloatMathType.html" title="trait inkwell::types::FloatMathType">FloatMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.FloatMathType.html#associatedtype.MathConvType" title="type inkwell::types::FloatMathType::MathConvType">MathConvType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.ValueType" title="type inkwell::types::IntMathType::ValueType">ValueType</a>, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_to_signed_int" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1965-1986">source</a><h4 class="code-header">pub fn <a href="#method.build_float_to_signed_int" class="fn">build_float_to_signed_int</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
float: T,
int_type: &lt;T::<a class="associatedtype" href="../values/trait.FloatMathValue.html#associatedtype.BaseType" title="type inkwell::values::FloatMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.FloatMathType.html" title="trait inkwell::types::FloatMathType">FloatMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.FloatMathType.html#associatedtype.MathConvType" title="type inkwell::types::FloatMathType::MathConvType">MathConvType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&lt;T::<a class="associatedtype" href="../values/trait.FloatMathValue.html#associatedtype.BaseType" title="type inkwell::values::FloatMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.FloatMathType.html" title="trait inkwell::types::FloatMathType">FloatMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.FloatMathType.html#associatedtype.MathConvType" title="type inkwell::types::FloatMathType::MathConvType">MathConvType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.ValueType" title="type inkwell::types::IntMathType::ValueType">ValueType</a>, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_unsigned_int_to_float" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#1989-2010">source</a><h4 class="code-header">pub fn <a href="#method.build_unsigned_int_to_float" class="fn">build_unsigned_int_to_float</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int: T,
float_type: &lt;T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.MathConvType" title="type inkwell::types::IntMathType::MathConvType">MathConvType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&lt;T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.MathConvType" title="type inkwell::types::IntMathType::MathConvType">MathConvType</a> as <a class="trait" href="../types/trait.FloatMathType.html" title="trait inkwell::types::FloatMathType">FloatMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.FloatMathType.html#associatedtype.ValueType" title="type inkwell::types::FloatMathType::ValueType">ValueType</a>, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_signed_int_to_float" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2012-2033">source</a><h4 class="code-header">pub fn <a href="#method.build_signed_int_to_float" class="fn">build_signed_int_to_float</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int: T,
float_type: &lt;T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.MathConvType" title="type inkwell::types::IntMathType::MathConvType">MathConvType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&lt;T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.MathConvType" title="type inkwell::types::IntMathType::MathConvType">MathConvType</a> as <a class="trait" href="../types/trait.FloatMathType.html" title="trait inkwell::types::FloatMathType">FloatMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.FloatMathType.html#associatedtype.ValueType" title="type inkwell::types::FloatMathType::ValueType">ValueType</a>, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_trunc" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2035-2055">source</a><h4 class="code-header">pub fn <a href="#method.build_float_trunc" class="fn">build_float_trunc</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
float: T,
float_type: T::<a class="associatedtype" href="../values/trait.FloatMathValue.html#associatedtype.BaseType" title="type inkwell::values::FloatMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_ext" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2057-2077">source</a><h4 class="code-header">pub fn <a href="#method.build_float_ext" class="fn">build_float_ext</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
float: T,
float_type: T::<a class="associatedtype" href="../values/trait.FloatMathValue.html#associatedtype.BaseType" title="type inkwell::values::FloatMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_cast" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2079-2099">source</a><h4 class="code-header">pub fn <a href="#method.build_float_cast" class="fn">build_float_cast</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
float: T,
float_type: T::<a class="associatedtype" href="../values/trait.FloatMathValue.html#associatedtype.BaseType" title="type inkwell::values::FloatMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_cast" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2102-2122">source</a><h4 class="code-header">pub fn <a href="#method.build_int_cast" class="fn">build_int_cast</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int: T,
int_type: T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><details class="toggle method-toggle" open><summary><section id="method.build_int_cast_sign_flag" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2126-2148">source</a><h4 class="code-header">pub fn <a href="#method.build_int_cast_sign_flag" class="fn">build_int_cast_sign_flag</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int: T,
int_type: T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a>,
is_signed: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Like <code>build_int_cast</code>, but respects the signedness of the type being cast to.</p>
</div></details><section id="method.build_float_div" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2150-2158">source</a><h4 class="code-header">pub fn <a href="#method.build_float_div" class="fn">build_float_div</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_add" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2161-2169">source</a><h4 class="code-header">pub fn <a href="#method.build_int_add" class="fn">build_int_add</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_nsw_add" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2173-2178">source</a><h4 class="code-header">pub fn <a href="#method.build_int_nsw_add" class="fn">build_int_nsw_add</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_nuw_add" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2182-2190">source</a><h4 class="code-header">pub fn <a href="#method.build_int_nuw_add" class="fn">build_int_nuw_add</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_add" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2193-2201">source</a><h4 class="code-header">pub fn <a href="#method.build_float_add" class="fn">build_float_add</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_xor" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2204-2212">source</a><h4 class="code-header">pub fn <a href="#method.build_xor" class="fn">build_xor</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_and" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2215-2223">source</a><h4 class="code-header">pub fn <a href="#method.build_and" class="fn">build_and</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_or" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2226-2234">source</a><h4 class="code-header">pub fn <a href="#method.build_or" class="fn">build_or</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><details class="toggle method-toggle" open><summary><section id="method.build_left_shift" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2279-2287">source</a><h4 class="code-header">pub fn <a href="#method.build_left_shift" class="fn">build_left_shift</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds an <code>IntValue</code> containing the result of a logical left shift instruction.</p>
<h5 id="example-8"><a href="#example-8">Example</a></h5>
<p>A logical left shift is an operation in which an integer values bits are shifted left by N number of positions.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(<span class="number">0b0000_0001 </span>&lt;&lt; <span class="number">0</span>, <span class="number">0b0000_0001</span>);
<span class="macro">assert_eq!</span>(<span class="number">0b0000_0001 </span>&lt;&lt; <span class="number">1</span>, <span class="number">0b0000_0010</span>);
<span class="macro">assert_eq!</span>(<span class="number">0b0000_0011 </span>&lt;&lt; <span class="number">2</span>, <span class="number">0b0000_1100</span>);</code></pre></div>
<p>In Rust, a function that could do this for 8bit values looks like:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>left_shift(value: u8, n: u8) -&gt; u8 {
value &lt;&lt; n
}</code></pre></div>
<p>And in Inkwell, the corresponding function would look roughly like:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="comment">// Setup
</span><span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"my_module"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>i8_type = context.i8_type();
<span class="kw">let </span>fn_type = i8_type.fn_type(<span class="kw-2">&amp;</span>[i8_type.into(), i8_type.into()], <span class="bool-val">false</span>);
<span class="comment">// Function Definition
</span><span class="kw">let </span>function = module.add_function(<span class="string">"left_shift"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>value = function.get_first_param().unwrap().into_int_value();
<span class="kw">let </span>n = function.get_nth_param(<span class="number">1</span>).unwrap().into_int_value();
<span class="kw">let </span>entry_block = context.append_basic_block(function, <span class="string">"entry"</span>);
builder.position_at_end(entry_block);
<span class="kw">let </span>shift = builder.build_left_shift(value, n, <span class="string">"left_shift"</span>).unwrap(); <span class="comment">// value &lt;&lt; n
</span>builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>shift)).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_right_shift" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2353-2373">source</a><h4 class="code-header">pub fn <a href="#method.build_right_shift" class="fn">build_right_shift</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
sign_extend: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds an <code>IntValue</code> containing the result of a right shift instruction.</p>
<h5 id="example-9"><a href="#example-9">Example</a></h5>
<p>A right shift is an operation in which an integer values bits are shifted right by N number of positions.
It may either be logical and have its leftmost N bit(s) filled with zeros or sign extended and filled with ones
if the leftmost bit was one.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">//fix doc error about overflowing_literals
//rendered rfc: https://github.com/rust-lang/rfcs/blob/master/text/2438-deny-integer-literal-overflow-lint.md
//tracking issue: https://github.com/rust-lang/rust/issues/54502
</span><span class="attr">#![allow(overflowing_literals)]
</span><span class="comment">// Logical Right Shift
</span><span class="macro">assert_eq!</span>(<span class="number">0b1100_0000u8 </span>&gt;&gt; <span class="number">2</span>, <span class="number">0b0011_0000</span>);
<span class="macro">assert_eq!</span>(<span class="number">0b0000_0010u8 </span>&gt;&gt; <span class="number">1</span>, <span class="number">0b0000_0001</span>);
<span class="macro">assert_eq!</span>(<span class="number">0b0000_1100u8 </span>&gt;&gt; <span class="number">2</span>, <span class="number">0b0000_0011</span>);
<span class="comment">// Sign Extended Right Shift
</span><span class="macro">assert_eq!</span>(<span class="number">0b0100_0000i8 </span>&gt;&gt; <span class="number">2</span>, <span class="number">0b0001_0000</span>);
<span class="macro">assert_eq!</span>(<span class="number">0b1110_0000u8 </span><span class="kw">as </span>i8 &gt;&gt; <span class="number">1</span>, <span class="number">0b1111_0000u8 </span><span class="kw">as </span>i8);
<span class="macro">assert_eq!</span>(<span class="number">0b1100_0000u8 </span><span class="kw">as </span>i8 &gt;&gt; <span class="number">2</span>, <span class="number">0b1111_0000u8 </span><span class="kw">as </span>i8);</code></pre></div>
<p>In Rust, functions that could do this for 8bit values look like:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>logical_right_shift(value: u8, n: u8) -&gt; u8 {
value &gt;&gt; n
}
<span class="kw">fn </span>sign_extended_right_shift(value: i8, n: u8) -&gt; i8 {
value &gt;&gt; n
}</code></pre></div>
<p>Notice that, in Rust (and most other languages), whether or not a value is sign extended depends wholly on whether
or not the type is signed (ie an i8 is a signed 8 bit value). LLVM does not make this distinction for you.</p>
<p>In Inkwell, the corresponding functions would look roughly like:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="comment">// Setup
</span><span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"my_module"</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>i8_type = context.i8_type();
<span class="kw">let </span>fn_type = i8_type.fn_type(<span class="kw-2">&amp;</span>[i8_type.into(), i8_type.into()], <span class="bool-val">false</span>);
<span class="comment">// Function Definition
</span><span class="kw">let </span>function = module.add_function(<span class="string">"right_shift"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>value = function.get_first_param().unwrap().into_int_value();
<span class="kw">let </span>n = function.get_nth_param(<span class="number">1</span>).unwrap().into_int_value();
<span class="kw">let </span>entry_block = context.append_basic_block(function, <span class="string">"entry"</span>);
builder.position_at_end(entry_block);
<span class="comment">// Whether or not your right shift is sign extended (true) or logical (false) depends
// on the boolean input parameter:
</span><span class="kw">let </span>shift = builder.build_right_shift(value, n, <span class="bool-val">false</span>, <span class="string">"right_shift"</span>).unwrap(); <span class="comment">// value &gt;&gt; n
</span>builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>shift)).unwrap();</code></pre></div>
</div></details><section id="method.build_int_sub" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2376-2384">source</a><h4 class="code-header">pub fn <a href="#method.build_int_sub" class="fn">build_int_sub</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_nsw_sub" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2387-2395">source</a><h4 class="code-header">pub fn <a href="#method.build_int_nsw_sub" class="fn">build_int_nsw_sub</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_nuw_sub" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2399-2407">source</a><h4 class="code-header">pub fn <a href="#method.build_int_nuw_sub" class="fn">build_int_nuw_sub</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_sub" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2410-2418">source</a><h4 class="code-header">pub fn <a href="#method.build_float_sub" class="fn">build_float_sub</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_mul" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2421-2429">source</a><h4 class="code-header">pub fn <a href="#method.build_int_mul" class="fn">build_int_mul</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_nsw_mul" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2433-2441">source</a><h4 class="code-header">pub fn <a href="#method.build_int_nsw_mul" class="fn">build_int_nsw_mul</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_nuw_mul" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2445-2453">source</a><h4 class="code-header">pub fn <a href="#method.build_int_nuw_mul" class="fn">build_int_nuw_mul</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_mul" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2456-2464">source</a><h4 class="code-header">pub fn <a href="#method.build_float_mul" class="fn">build_float_mul</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_cast" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2466-2488">source</a><h4 class="code-header">pub fn <a href="#method.build_cast" class="fn">build_cast</a>&lt;T: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;, V: <a class="trait" href="../values/trait.BasicValue.html" title="trait inkwell::values::BasicValue">BasicValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
op: <a class="enum" href="../values/enum.InstructionOpcode.html" title="enum inkwell::values::InstructionOpcode">InstructionOpcode</a>,
from_value: V,
to_type: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_pointer_cast" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2491-2505">source</a><h4 class="code-header">pub fn <a href="#method.build_pointer_cast" class="fn">build_pointer_cast</a>&lt;T: <a class="trait" href="../values/trait.PointerMathValue.html" title="trait inkwell::values::PointerMathValue">PointerMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
from: T,
to: T::<a class="associatedtype" href="../values/trait.PointerMathValue.html#associatedtype.BaseType" title="type inkwell::values::PointerMathValue::BaseType">BaseType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_compare" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2511-2533">source</a><h4 class="code-header">pub fn <a href="#method.build_int_compare" class="fn">build_int_compare</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
op: <a class="enum" href="../enum.IntPredicate.html" title="enum inkwell::IntPredicate">IntPredicate</a>,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.ValueType" title="type inkwell::types::IntMathType::ValueType">ValueType</a>, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_compare" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2537-2561">source</a><h4 class="code-header">pub fn <a href="#method.build_float_compare" class="fn">build_float_compare</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
op: <a class="enum" href="../enum.FloatPredicate.html" title="enum inkwell::FloatPredicate">FloatPredicate</a>,
lhs: T,
rhs: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&lt;T::<a class="associatedtype" href="../values/trait.FloatMathValue.html#associatedtype.BaseType" title="type inkwell::values::FloatMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.FloatMathType.html" title="trait inkwell::types::FloatMathType">FloatMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.FloatMathType.html#associatedtype.MathConvType" title="type inkwell::types::FloatMathType::MathConvType">MathConvType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.ValueType" title="type inkwell::types::IntMathType::ValueType">ValueType</a>, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_unconditional_branch" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2563-2573">source</a><h4 class="code-header">pub fn <a href="#method.build_unconditional_branch" class="fn">build_unconditional_branch</a>(
&amp;self,
destination_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_conditional_branch" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2575-2594">source</a><h4 class="code-header">pub fn <a href="#method.build_conditional_branch" class="fn">build_conditional_branch</a>(
&amp;self,
comparison: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;,
then_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;,
else_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_indirect_branch" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2596-2611">source</a><h4 class="code-header">pub fn <a href="#method.build_indirect_branch" class="fn">build_indirect_branch</a>&lt;BV: <a class="trait" href="../values/trait.BasicValue.html" title="trait inkwell::values::BasicValue">BasicValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
address: BV,
destinations: &amp;[<a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;]
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_neg" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2614-2622">source</a><h4 class="code-header">pub fn <a href="#method.build_int_neg" class="fn">build_int_neg</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
value: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_nsw_neg" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2626-2634">source</a><h4 class="code-header">pub fn <a href="#method.build_int_nsw_neg" class="fn">build_int_nsw_neg</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
value: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_nuw_neg" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2637-2645">source</a><h4 class="code-header">pub fn <a href="#method.build_int_nuw_neg" class="fn">build_int_nuw_neg</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
value: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_float_neg" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2648-2656">source</a><h4 class="code-header">pub fn <a href="#method.build_float_neg" class="fn">build_float_neg</a>&lt;T: <a class="trait" href="../values/trait.FloatMathValue.html" title="trait inkwell::values::FloatMathValue">FloatMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
value: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_not" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2659-2667">source</a><h4 class="code-header">pub fn <a href="#method.build_not" class="fn">build_not</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
value: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><details class="toggle method-toggle" open><summary><section id="method.position_at" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2674-2678">source</a><h4 class="code-header">pub fn <a href="#method.position_at" class="fn">position_at</a>(
&amp;self,
basic_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;,
instruction: &amp;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;
)</h4></section></summary><div class="docblock"><p>Set the position of the builder to after an instruction.</p>
<p>Be sure to call one of the <code>position_*</code> methods or all <code>build_*</code> methods will return <code>Err(BuilderError::UnsetPosition)</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_before" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2683-2687">source</a><h4 class="code-header">pub fn <a href="#method.position_before" class="fn">position_before</a>(&amp;self, instruction: &amp;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;)</h4></section></summary><div class="docblock"><p>Set the position of the builder to before an instruction.</p>
<p>Be sure to call one of the <code>position_*</code> methods or all <code>build_*</code> methods will return <code>Err(BuilderError::UnsetPosition)</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.position_at_end" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2692-2698">source</a><h4 class="code-header">pub fn <a href="#method.position_at_end" class="fn">position_at_end</a>(&amp;self, basic_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;)</h4></section></summary><div class="docblock"><p>Set the position of the builder to the end of a basic block.</p>
<p>Be sure to call one of the <code>position_*</code> methods or all <code>build_*</code> methods will return <code>Err(BuilderError::UnsetPosition)</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_extract_value" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2758-2781">source</a><h4 class="code-header">pub fn <a href="#method.build_extract_value" class="fn">build_extract_value</a>&lt;AV: <a class="trait" href="../values/trait.AggregateValue.html" title="trait inkwell::values::AggregateValue">AggregateValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
agg: AV,
index: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds an extract value instruction which extracts a <code>BasicValueEnum</code>
from a struct or array.</p>
<p>Returns <code>Err(BuilderError::ExtractOutOfRange)</code> if the provided index is out of bounds of the aggregate value length.</p>
<h5 id="example-10"><a href="#example-10">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::builder::BuilderError;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"av"</span>);
<span class="kw">let </span>void_type = context.void_type();
<span class="kw">let </span>f32_type = context.f32_type();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>struct_type = context.struct_type(<span class="kw-2">&amp;</span>[i32_type.into(), f32_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>array_type = i32_type.array_type(<span class="number">3</span>);
<span class="kw">let </span>fn_type = void_type.fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"av_fn"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
builder.position_at_end(entry);
<span class="kw">let </span>array_alloca = builder.build_alloca(array_type, <span class="string">"array_alloca"</span>).unwrap();
<span class="attr">#[cfg(any(
feature = <span class="string">"llvm4-0"</span>,
feature = <span class="string">"llvm5-0"</span>,
feature = <span class="string">"llvm6-0"</span>,
feature = <span class="string">"llvm7-0"</span>,
feature = <span class="string">"llvm8-0"</span>,
feature = <span class="string">"llvm9-0"</span>,
feature = <span class="string">"llvm10-0"</span>,
feature = <span class="string">"llvm11-0"</span>,
feature = <span class="string">"llvm12-0"</span>,
feature = <span class="string">"llvm13-0"</span>,
feature = <span class="string">"llvm14-0"
</span>))]
</span><span class="kw">let </span>array = builder.build_load(array_alloca, <span class="string">"array_load"</span>).unwrap().into_array_value();
<span class="attr">#[cfg(any(feature = <span class="string">"llvm15-0"</span>, feature = <span class="string">"llvm16-0"</span>, feature = <span class="string">"llvm17-0"</span>))]
</span><span class="kw">let </span>array = builder.build_load(i32_type, array_alloca, <span class="string">"array_load"</span>).unwrap().into_array_value();
<span class="kw">let </span>const_int1 = i32_type.const_int(<span class="number">2</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>const_int2 = i32_type.const_int(<span class="number">5</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>const_int3 = i32_type.const_int(<span class="number">6</span>, <span class="bool-val">false</span>);
<span class="macro">assert!</span>(builder.build_insert_value(array, const_int1, <span class="number">0</span>, <span class="string">"insert"</span>).is_ok());
<span class="macro">assert!</span>(builder.build_insert_value(array, const_int2, <span class="number">1</span>, <span class="string">"insert"</span>).is_ok());
<span class="macro">assert!</span>(builder.build_insert_value(array, const_int3, <span class="number">2</span>, <span class="string">"insert"</span>).is_ok());
<span class="macro">assert!</span>(builder.build_insert_value(array, const_int3, <span class="number">3</span>, <span class="string">"insert"</span>).is_err_and(|e| e == BuilderError::ExtractOutOfRange));
<span class="macro">assert!</span>(builder.build_extract_value(array, <span class="number">0</span>, <span class="string">"extract"</span>).unwrap().is_int_value());
<span class="macro">assert!</span>(builder.build_extract_value(array, <span class="number">1</span>, <span class="string">"extract"</span>).unwrap().is_int_value());
<span class="macro">assert!</span>(builder.build_extract_value(array, <span class="number">2</span>, <span class="string">"extract"</span>).unwrap().is_int_value());
<span class="macro">assert!</span>(builder.build_extract_value(array, <span class="number">3</span>, <span class="string">"extract"</span>).is_err_and(|e| e == BuilderError::ExtractOutOfRange));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_insert_value" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2836-2872">source</a><h4 class="code-header">pub fn <a href="#method.build_insert_value" class="fn">build_insert_value</a>&lt;AV, BV&gt;(
&amp;self,
agg: AV,
value: BV,
index: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../values/enum.AggregateValueEnum.html" title="enum inkwell::values::AggregateValueEnum">AggregateValueEnum</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;<div class="where">where
AV: <a class="trait" href="../values/trait.AggregateValue.html" title="trait inkwell::values::AggregateValue">AggregateValue</a>&lt;'ctx&gt;,
BV: <a class="trait" href="../values/trait.BasicValue.html" title="trait inkwell::values::BasicValue">BasicValue</a>&lt;'ctx&gt;,</div></h4></section></summary><div class="docblock"><p>Builds an insert value instruction which inserts a <code>BasicValue</code> into a struct
or array and returns the resulting aggregate value.</p>
<p>Returns <code>Err(BuilderError::ExtractOutOfRange)</code> if the provided index is out of bounds of the aggregate value length.</p>
<h5 id="example-11"><a href="#example-11">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::builder::BuilderError;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"av"</span>);
<span class="kw">let </span>void_type = context.void_type();
<span class="kw">let </span>f32_type = context.f32_type();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>struct_type = context.struct_type(<span class="kw-2">&amp;</span>[i32_type.into(), f32_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>array_type = i32_type.array_type(<span class="number">3</span>);
<span class="kw">let </span>fn_type = void_type.fn_type(<span class="kw-2">&amp;</span>[], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"av_fn"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
builder.position_at_end(entry);
<span class="kw">let </span>array_alloca = builder.build_alloca(array_type, <span class="string">"array_alloca"</span>).unwrap();
<span class="attr">#[cfg(any(
feature = <span class="string">"llvm4-0"</span>,
feature = <span class="string">"llvm5-0"</span>,
feature = <span class="string">"llvm6-0"</span>,
feature = <span class="string">"llvm7-0"</span>,
feature = <span class="string">"llvm8-0"</span>,
feature = <span class="string">"llvm9-0"</span>,
feature = <span class="string">"llvm10-0"</span>,
feature = <span class="string">"llvm11-0"</span>,
feature = <span class="string">"llvm12-0"</span>,
feature = <span class="string">"llvm13-0"</span>,
feature = <span class="string">"llvm14-0"
</span>))]
</span><span class="kw">let </span>array = builder.build_load(array_alloca, <span class="string">"array_load"</span>).unwrap().into_array_value();
<span class="attr">#[cfg(any(feature = <span class="string">"llvm15-0"</span>, feature = <span class="string">"llvm16-0"</span>, feature = <span class="string">"llvm17-0"</span>))]
</span><span class="kw">let </span>array = builder.build_load(i32_type, array_alloca, <span class="string">"array_load"</span>).unwrap().into_array_value();
<span class="kw">let </span>const_int1 = i32_type.const_int(<span class="number">2</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>const_int2 = i32_type.const_int(<span class="number">5</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>const_int3 = i32_type.const_int(<span class="number">6</span>, <span class="bool-val">false</span>);
<span class="macro">assert!</span>(builder.build_insert_value(array, const_int1, <span class="number">0</span>, <span class="string">"insert"</span>).is_ok());
<span class="macro">assert!</span>(builder.build_insert_value(array, const_int2, <span class="number">1</span>, <span class="string">"insert"</span>).is_ok());
<span class="macro">assert!</span>(builder.build_insert_value(array, const_int3, <span class="number">2</span>, <span class="string">"insert"</span>).is_ok());
<span class="macro">assert!</span>(builder.build_insert_value(array, const_int3, <span class="number">3</span>, <span class="string">"insert"</span>).is_err_and(|e| e == BuilderError::ExtractOutOfRange));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_extract_element" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2898-2919">source</a><h4 class="code-header">pub fn <a href="#method.build_extract_element" class="fn">build_extract_element</a>(
&amp;self,
vector: <a class="struct" href="../values/struct.VectorValue.html" title="struct inkwell::values::VectorValue">VectorValue</a>&lt;'ctx&gt;,
index: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds an extract element instruction which extracts a <code>BasicValueEnum</code>
from a vector.</p>
<h5 id="example-12"><a href="#example-12">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"av"</span>);
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>i32_zero = i32_type.const_int(<span class="number">0</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>vec_type = i32_type.vec_type(<span class="number">2</span>);
<span class="kw">let </span>fn_type = i32_type.fn_type(<span class="kw-2">&amp;</span>[vec_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"vec_fn"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>vector_param = fn_value.get_first_param().unwrap().into_vector_value();
builder.position_at_end(entry);
<span class="kw">let </span>extracted = builder.build_extract_element(vector_param, i32_zero, <span class="string">"insert"</span>).unwrap();
builder.build_return(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>extracted)).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_insert_element" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2946-2969">source</a><h4 class="code-header">pub fn <a href="#method.build_insert_element" class="fn">build_insert_element</a>&lt;V: <a class="trait" href="../values/trait.BasicValue.html" title="trait inkwell::values::BasicValue">BasicValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
vector: <a class="struct" href="../values/struct.VectorValue.html" title="struct inkwell::values::VectorValue">VectorValue</a>&lt;'ctx&gt;,
element: V,
index: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.VectorValue.html" title="struct inkwell::values::VectorValue">VectorValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds an insert element instruction which inserts a <code>BasicValue</code> into a vector
and returns the resulting vector.</p>
<h5 id="example-13"><a href="#example-13">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"av"</span>);
<span class="kw">let </span>void_type = context.void_type();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>i32_zero = i32_type.const_int(<span class="number">0</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>i32_seven = i32_type.const_int(<span class="number">7</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>vec_type = i32_type.vec_type(<span class="number">2</span>);
<span class="kw">let </span>fn_type = void_type.fn_type(<span class="kw-2">&amp;</span>[vec_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"vec_fn"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>builder = context.create_builder();
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>vector_param = fn_value.get_first_param().unwrap().into_vector_value();
builder.position_at_end(entry);
builder.build_insert_element(vector_param, i32_seven, i32_zero, <span class="string">"insert"</span>).unwrap();
builder.build_return(<span class="prelude-val">None</span>).unwrap();</code></pre></div>
</div></details><section id="method.build_unreachable" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2971-2978">source</a><h4 class="code-header">pub fn <a href="#method.build_unreachable" class="fn">build_unreachable</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_fence" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2982-2996">source</a><h4 class="code-header">pub fn <a href="#method.build_fence" class="fn">build_fence</a>(
&amp;self,
atomic_ordering: <a class="enum" href="../enum.AtomicOrdering.html" title="enum inkwell::AtomicOrdering">AtomicOrdering</a>,
num: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.i32.html">i32</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_is_null" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#2999-3012">source</a><h4 class="code-header">pub fn <a href="#method.build_is_null" class="fn">build_is_null</a>&lt;T: <a class="trait" href="../values/trait.PointerMathValue.html" title="trait inkwell::values::PointerMathValue">PointerMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
ptr: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&lt;T::<a class="associatedtype" href="../values/trait.PointerMathValue.html#associatedtype.BaseType" title="type inkwell::values::PointerMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.PointerMathType.html" title="trait inkwell::types::PointerMathType">PointerMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.PointerMathType.html#associatedtype.PtrConvType" title="type inkwell::types::PointerMathType::PtrConvType">PtrConvType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.ValueType" title="type inkwell::types::IntMathType::ValueType">ValueType</a>, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_is_not_null" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3015-3028">source</a><h4 class="code-header">pub fn <a href="#method.build_is_not_null" class="fn">build_is_not_null</a>&lt;T: <a class="trait" href="../values/trait.PointerMathValue.html" title="trait inkwell::values::PointerMathValue">PointerMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
ptr: T,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&lt;T::<a class="associatedtype" href="../values/trait.PointerMathValue.html#associatedtype.BaseType" title="type inkwell::values::PointerMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.PointerMathType.html" title="trait inkwell::types::PointerMathType">PointerMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.PointerMathType.html#associatedtype.PtrConvType" title="type inkwell::types::PointerMathType::PtrConvType">PtrConvType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.ValueType" title="type inkwell::types::IntMathType::ValueType">ValueType</a>, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_int_to_ptr" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3031-3053">source</a><h4 class="code-header">pub fn <a href="#method.build_int_to_ptr" class="fn">build_int_to_ptr</a>&lt;T: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
int: T,
ptr_type: &lt;T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.PtrConvType" title="type inkwell::types::IntMathType::PtrConvType">PtrConvType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&lt;T::<a class="associatedtype" href="../values/trait.IntMathValue.html#associatedtype.BaseType" title="type inkwell::values::IntMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.PtrConvType" title="type inkwell::types::IntMathType::PtrConvType">PtrConvType</a> as <a class="trait" href="../types/trait.PointerMathType.html" title="trait inkwell::types::PointerMathType">PointerMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.PointerMathType.html#associatedtype.ValueType" title="type inkwell::types::PointerMathType::ValueType">ValueType</a>, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_ptr_to_int" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3056-3078">source</a><h4 class="code-header">pub fn <a href="#method.build_ptr_to_int" class="fn">build_ptr_to_int</a>&lt;T: <a class="trait" href="../values/trait.PointerMathValue.html" title="trait inkwell::values::PointerMathValue">PointerMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
ptr: T,
int_type: &lt;T::<a class="associatedtype" href="../values/trait.PointerMathValue.html#associatedtype.BaseType" title="type inkwell::values::PointerMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.PointerMathType.html" title="trait inkwell::types::PointerMathType">PointerMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.PointerMathType.html#associatedtype.PtrConvType" title="type inkwell::types::PointerMathType::PtrConvType">PtrConvType</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;&lt;T::<a class="associatedtype" href="../values/trait.PointerMathValue.html#associatedtype.BaseType" title="type inkwell::values::PointerMathValue::BaseType">BaseType</a> as <a class="trait" href="../types/trait.PointerMathType.html" title="trait inkwell::types::PointerMathType">PointerMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.PointerMathType.html#associatedtype.PtrConvType" title="type inkwell::types::PointerMathType::PtrConvType">PtrConvType</a> as <a class="trait" href="../types/trait.IntMathType.html" title="trait inkwell::types::IntMathType">IntMathType</a>&lt;'ctx&gt;&gt;::<a class="associatedtype" href="../types/trait.IntMathType.html#associatedtype.ValueType" title="type inkwell::types::IntMathType::ValueType">ValueType</a>, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.clear_insertion_position" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3080-3082">source</a><h4 class="code-header">pub fn <a href="#method.clear_insertion_position" class="fn">clear_insertion_position</a>(&amp;self)</h4></section><section id="method.build_switch" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3087-3110">source</a><h4 class="code-header">pub fn <a href="#method.build_switch" class="fn">build_switch</a>(
&amp;self,
value: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;,
else_block: <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;,
cases: &amp;[(<a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;, <a class="struct" href="../basic_block/struct.BasicBlock.html" title="struct inkwell::basic_block::BasicBlock">BasicBlock</a>&lt;'ctx&gt;)]
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.InstructionValue.html" title="struct inkwell::values::InstructionValue">InstructionValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_select" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3113-3135">source</a><h4 class="code-header">pub fn <a href="#method.build_select" class="fn">build_select</a>&lt;BV: <a class="trait" href="../values/trait.BasicValue.html" title="trait inkwell::values::BasicValue">BasicValue</a>&lt;'ctx&gt;, IMV: <a class="trait" href="../values/trait.IntMathValue.html" title="trait inkwell::values::IntMathValue">IntMathValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
condition: IMV,
then: BV,
else_: BV,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_global_string" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3138-3147">source</a><h4 class="code-header">pub unsafe fn <a href="#method.build_global_string" class="fn">build_global_string</a>(
&amp;self,
value: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.GlobalValue.html" title="struct inkwell::values::GlobalValue">GlobalValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_global_string_ptr" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3151-3160">source</a><h4 class="code-header">pub fn <a href="#method.build_global_string_ptr" class="fn">build_global_string_ptr</a>(
&amp;self,
value: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.GlobalValue.html" title="struct inkwell::values::GlobalValue">GlobalValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_shuffle_vector" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3163-3185">source</a><h4 class="code-header">pub fn <a href="#method.build_shuffle_vector" class="fn">build_shuffle_vector</a>(
&amp;self,
left: <a class="struct" href="../values/struct.VectorValue.html" title="struct inkwell::values::VectorValue">VectorValue</a>&lt;'ctx&gt;,
right: <a class="struct" href="../values/struct.VectorValue.html" title="struct inkwell::values::VectorValue">VectorValue</a>&lt;'ctx&gt;,
mask: <a class="struct" href="../values/struct.VectorValue.html" title="struct inkwell::values::VectorValue">VectorValue</a>&lt;'ctx&gt;,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.VectorValue.html" title="struct inkwell::values::VectorValue">VectorValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><section id="method.build_va_arg" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3190-3211">source</a><h4 class="code-header">pub fn <a href="#method.build_va_arg" class="fn">build_va_arg</a>&lt;BT: <a class="trait" href="../types/trait.BasicType.html" title="trait inkwell::types::BasicType">BasicType</a>&lt;'ctx&gt;&gt;(
&amp;self,
list: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
type_: BT,
name: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../values/enum.BasicValueEnum.html" title="enum inkwell::values::BasicValueEnum">BasicValueEnum</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section><details class="toggle method-toggle" open><summary><section id="method.build_atomicrmw" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3240-3278">source</a><h4 class="code-header">pub fn <a href="#method.build_atomicrmw" class="fn">build_atomicrmw</a>(
&amp;self,
op: <a class="enum" href="../enum.AtomicRMWBinOp.html" title="enum inkwell::AtomicRMWBinOp">AtomicRMWBinOp</a>,
ptr: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
value: <a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;,
ordering: <a class="enum" href="../enum.AtomicOrdering.html" title="enum inkwell::AtomicOrdering">AtomicOrdering</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.IntValue.html" title="struct inkwell::values::IntValue">IntValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds an atomicrmw instruction. It allows you to atomically modify memory.</p>
<p>May return of the following errors:</p>
<ul>
<li><code>Err(BuilderError::BitwidthError)</code> if the bitwidth of the value is not a power of 2 and less than 8</li>
<li><code>Err(BuilderError:PointeeTypeMismatch)</code> if the pointee type does not match the values type</li>
</ul>
<h5 id="example-14"><a href="#example-14">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::{AddressSpace, AtomicOrdering, AtomicRMWBinOp};
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"rmw"</span>);
<span class="kw">let </span>void_type = context.void_type();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>i32_seven = i32_type.const_int(<span class="number">7</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>i32_ptr_type = i32_type.ptr_type(AddressSpace::default());
<span class="kw">let </span>fn_type = void_type.fn_type(<span class="kw-2">&amp;</span>[i32_ptr_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">"rmw"</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>i32_ptr_param = fn_value.get_first_param().unwrap().into_pointer_value();
<span class="kw">let </span>builder = context.create_builder();
builder.position_at_end(entry);
builder.build_atomicrmw(AtomicRMWBinOp::Add, i32_ptr_param, i32_seven, AtomicOrdering::Unordered).unwrap();
builder.build_return(<span class="prelude-val">None</span>).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.build_cmpxchg" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3313-3374">source</a><h4 class="code-header">pub fn <a href="#method.build_cmpxchg" class="fn">build_cmpxchg</a>&lt;V: <a class="trait" href="../values/trait.BasicValue.html" title="trait inkwell::values::BasicValue">BasicValue</a>&lt;'ctx&gt;&gt;(
&amp;self,
ptr: <a class="struct" href="../values/struct.PointerValue.html" title="struct inkwell::values::PointerValue">PointerValue</a>&lt;'ctx&gt;,
cmp: V,
new: V,
success: <a class="enum" href="../enum.AtomicOrdering.html" title="enum inkwell::AtomicOrdering">AtomicOrdering</a>,
failure: <a class="enum" href="../enum.AtomicOrdering.html" title="enum inkwell::AtomicOrdering">AtomicOrdering</a>
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="../values/struct.StructValue.html" title="struct inkwell::values::StructValue">StructValue</a>&lt;'ctx&gt;, <a class="enum" href="enum.BuilderError.html" title="enum inkwell::builder::BuilderError">BuilderError</a>&gt;</h4></section></summary><div class="docblock"><p>Builds a cmpxchg instruction. It allows you to atomically compare and replace memory.</p>
<p>May return one of the following errors:</p>
<ul>
<li><code>Err(BuilderError::PointeeTypeMismatch)</code> if the pointer does not point to an element of the value type</li>
<li><code>Err(BuilderError::ValueTypeMismatch)</code> if the value to compare and the new values are not of the same type, or if
the value does not have a pointer or integer type</li>
<li><code>Err(BuilderError::OrderingError)</code> if the following conditions are not satisfied:
<ul>
<li>Both success and failure orderings are not Monotonic or stronger</li>
<li>The failure ordering is stronger than the success ordering</li>
<li>The failure ordering is release or acquire release</li>
</ul>
</li>
</ul>
<h5 id="example-15"><a href="#example-15">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>inkwell::context::Context;
<span class="kw">use </span>inkwell::{AddressSpace, AtomicOrdering};
<span class="kw">let </span>context = Context::create();
<span class="kw">let </span>module = context.create_module(<span class="string">"cmpxchg"</span>);
<span class="kw">let </span>void_type = context.void_type();
<span class="kw">let </span>i32_type = context.i32_type();
<span class="kw">let </span>i32_ptr_type = i32_type.ptr_type(AddressSpace::default());
<span class="kw">let </span>fn_type = void_type.fn_type(<span class="kw-2">&amp;</span>[i32_ptr_type.into()], <span class="bool-val">false</span>);
<span class="kw">let </span>fn_value = module.add_function(<span class="string">""</span>, fn_type, <span class="prelude-val">None</span>);
<span class="kw">let </span>i32_ptr_param = fn_value.get_first_param().unwrap().into_pointer_value();
<span class="kw">let </span>i32_seven = i32_type.const_int(<span class="number">7</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>i32_eight = i32_type.const_int(<span class="number">8</span>, <span class="bool-val">false</span>);
<span class="kw">let </span>entry = context.append_basic_block(fn_value, <span class="string">"entry"</span>);
<span class="kw">let </span>builder = context.create_builder();
builder.position_at_end(entry);
builder.build_cmpxchg(i32_ptr_param, i32_seven, i32_eight, AtomicOrdering::AcquireRelease, AtomicOrdering::Monotonic).unwrap();
builder.build_return(<span class="prelude-val">None</span>).unwrap();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_current_debug_location" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3391-3396">source</a><h4 class="code-header">pub fn <a href="#method.set_current_debug_location" class="fn">set_current_debug_location</a>(&amp;self, location: <a class="struct" href="../debug_info/struct.DILocation.html" title="struct inkwell::debug_info::DILocation">DILocation</a>&lt;'ctx&gt;)</h4></section></summary><div class="docblock"><p>Set the debug info source location of the instruction currently pointed at by the builder</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_current_debug_location" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3401-3412">source</a><h4 class="code-header">pub fn <a href="#method.get_current_debug_location" class="fn">get_current_debug_location</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../debug_info/struct.DILocation.html" title="struct inkwell::debug_info::DILocation">DILocation</a>&lt;'ctx&gt;&gt;</h4></section></summary><div class="docblock"><p>Get the debug info source location of the instruction currently pointed at by the builder,
if available.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.unset_current_debug_location" class="method"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3427-3432">source</a><h4 class="code-header">pub fn <a href="#method.unset_current_debug_location" class="fn">unset_current_debug_location</a>(&amp;self)</h4></section></summary><div class="docblock"><p>Unset the debug info source location of the instruction currently pointed at by the
builder. If there isnt any debug info, this is a no-op.</p>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Builder%3C'ctx%3E" class="impl"><a class="src rightside" href="../../src/inkwell/builder.rs.html#87">source</a><a href="#impl-Debug-for-Builder%3C'ctx%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'ctx&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Builder.html" title="struct inkwell::builder::Builder">Builder</a>&lt;'ctx&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/inkwell/builder.rs.html#87">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.76.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Drop-for-Builder%3C'_%3E" class="impl"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3444-3450">source</a><a href="#impl-Drop-for-Builder%3C'_%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="struct.Builder.html" title="struct inkwell::builder::Builder">Builder</a>&lt;'_&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.drop" class="method trait-impl"><a class="src rightside" href="../../src/inkwell/builder.rs.html#3445-3449">source</a><a href="#method.drop" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/drop/trait.Drop.html#tymethod.drop" class="fn">drop</a>(&amp;mut self)</h4></section></summary><div class='docblock'>Executes the destructor for this type. <a href="https://doc.rust-lang.org/1.76.0/core/ops/drop/trait.Drop.html#tymethod.drop">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Builder%3C'ctx%3E" class="impl"><a href="#impl-RefUnwindSafe-for-Builder%3C'ctx%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'ctx&gt; !<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Builder.html" title="struct inkwell::builder::Builder">Builder</a>&lt;'ctx&gt;</h3></section><section id="impl-Send-for-Builder%3C'ctx%3E" class="impl"><a href="#impl-Send-for-Builder%3C'ctx%3E" class="anchor">§</a><h3 class="code-header">impl&lt;'ctx&gt; !<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Builder.html" title="struct inkwell::builder::Builder">Builder</a>&lt;'ctx&gt;</h3></section><section id="impl-Sync-for-Builder%3C'ctx%3E" class="impl"><a href="#impl-Sync-for-Builder%3C'ctx%3E" class="anchor">§</a><h3 class="cod
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#763">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#766">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#747-749">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#756">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#803-805">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#810">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#788-790">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#795">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>