Add construction and assignment for rust::Vec
diff --git a/src/rust_vec.rs b/src/rust_vec.rs
index 564851e..d5de489 100644
--- a/src/rust_vec.rs
+++ b/src/rust_vec.rs
@@ -7,6 +7,10 @@
}
impl<T> RustVec<T> {
+ pub fn new() -> Self {
+ RustVec { repr: Vec::new() }
+ }
+
pub fn from(v: Vec<T>) -> Self {
RustVec { repr: v }
}
@@ -43,6 +47,12 @@
const _: () = {
attr! {
+ #[export_name = concat!("cxxbridge02$rust_vec$", stringify!($ty), "$new")]
+ unsafe extern "C" fn __new(this: *mut RustVec<$ty>) {
+ ptr::write(this, RustVec::new());
+ }
+ }
+ attr! {
#[export_name = concat!("cxxbridge02$rust_vec$", stringify!($ty), "$drop")]
unsafe extern "C" fn __drop(this: *mut RustVec<$ty>) {
ptr::drop_in_place(this);