about summary refs log tree commit diff
path: root/src/rt/rust_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/rt/rust_util.h')
-rw-r--r--src/rt/rust_util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/rt/rust_util.h b/src/rt/rust_util.h
index 7118572393f..1137a63c0e1 100644
--- a/src/rt/rust_util.h
+++ b/src/rt/rust_util.h
@@ -218,6 +218,19 @@ inline void reserve_vec(rust_task* task, rust_vec** vpp, size_t size) {
     }
 }
 
+inline rust_vec *
+make_istr(rust_kernel* kernel, char* c, size_t strlen, const char* name) {
+    size_t str_fill = strlen + 1;
+    size_t str_alloc = str_fill;
+    rust_vec *str = (rust_vec *)
+        kernel->malloc(vec_size<char>(str_fill), name);
+    str->fill = str_fill;
+    str->alloc = str_alloc;
+    memcpy(&str->data, c, strlen);
+    str->data[strlen] = '\0';
+    return str;
+}
+
 //
 // Local Variables:
 // mode: C++