Function voluntary_servitude::ffi::vs_new
source · #[no_mangle]
pub unsafe extern "C" fn vs_new(
) -> *mut VoluntaryServitude<*const c_void>
Expand description
Creates new empty VoluntaryServitude
vs_drop
should be called eventually for VoluntaryServitude
returned, otherwise memory will leak
Rust
use voluntary_servitude::ffi::*;
unsafe {
let vs = vs_new();
assert_eq!(vs_len(vs), 0);
assert_eq!(vs_destroy(vs), 0);
}
C
#include<assert.h>
#include "../include/voluntary_servitude.h"
int main(int argc, char **argv) {
vs_t * vs = vs_new();
assert(vs_len(vs) == 0);
assert(vs_destroy(vs) == 0);
return 0;
}