c_vec 1.0.11

Structures to wrap C arrays
docs.rs failed to build c_vec-1.0.11
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: c_vec-2.0.0

c_vec Build Status

Structures to wrap C arrays. Here's a little example:

extern crate libc;
extern crate c_vec;

use c_vec::{CVec, CSlice};
use std::ptr::Unique;

fn some_func(cvec: *mut libc::c_int, len: uint) {
    // safe wrapper, you can pass a destructor with new_with_dtor() method
    let v = CVec::new(Unique::new(cvec), len);
    // unsafe wrapper with no destructor
    let s = CSlice::new(cvec, len);

    println!("cvec:   converted from c array: {}", v.as_slice());
    println!("cslice: converted from c array: {}", s.as_mut_slice());
}

Usage

You can use it directly by adding this line to your Cargo.toml file:

[dependencies]
c_vec = "^1.0.0"

Here's the crates.io page for c_vec.

License

This project is under the MIT and Apache 2.0 licenses. Please take a look at the license files for more information.