cslice 0.1.0

A library of slices with a stable ABI for interfacing with C.
Documentation

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.