Skip to content

Commit 5d90a54

Browse files
committed
Add Value::new_vector
1 parent 5c5f01b commit 5d90a54

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/value.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ impl Value {
1717
pub fn new_struct<'a>(context: &'a Context, vals: &[&'a Value], packed: bool) -> &'a Value {
1818
unsafe { core::LLVMConstStructInContext(context.into(), vals.as_ptr() as *mut LLVMValueRef, vals.len() as c_uint, packed as c_int) }.into()
1919
}
20+
/// Create a new constant vector from the values given.
21+
pub fn new_vector<'a>(vals: &[&'a Value]) -> &'a Value {
22+
unsafe { core::LLVMConstVector(vals.as_ptr() as *mut LLVMValueRef, vals.len() as c_uint).into() }
23+
}
2024
/// Create a new constant C string from the text given.
2125
pub fn new_string<'a>(context: &'a Context, text: &str, rust_style: bool) -> &'a Value {
2226
unsafe {

0 commit comments

Comments
 (0)