4 releases (2 breaking)
Uses old Rust 2015
0.3.0 | Feb 1, 2017 |
---|---|
0.2.0 | Feb 1, 2017 |
0.1.1 | May 11, 2016 |
0.1.0 | Apr 5, 2016 |
#2885 in Rust patterns
4,586 downloads per month
Used in 8 crates
(via helix_runtime)
7KB
138 lines
CSlice
This library provides an API like Rust slices, but with a guaranteed ABI for interfacing with C/C++.
lib.rs
:
A library of C-slices: slices with a stable ABI for interfacing with C.
This library provides two types, CSlice
and CMutSlice
, for communicating
with C about Rust slices or foreign slice-like data structures. Both types
have a stable ABI consisting of exactly two pointer-sized words:
struct {
void *base;
size_t len;
}
C-slices and Rust slices are interchangeable, with conversion methods in both directions.
This makes it possible to construct slices from foreign code, as well as to communicate Rust slices to foreign code conveniently.