Crate null_terminated[][src]

Expand description

Library of null-terminated slices and UTF-8-encoded strings, references to which are thin pointers for efficiency and ease of use with FFI

The likely primary use cases are C FFI and OS ABI (for example: on Unix, many system calls take, and the initial environment involves, null-terminated arguments).

As the representation is a bare pointer to the element type, one can declare foreign functions which merely take arguments or return values of type Nul<_>, for example:

extern "C" {
    fn strlen(_: &Nul<u8>) -> usize;
    fn strchr(_: &Nul<u8>, _: c_int) -> &Nul<u8>;
}

For further examples, see the docs of Nul.

Macros

Constructs a &Nul<&T>.

Make a static Nul<u8>.

Make a static NulStr.

Structs

Iterator over the characters of a null-terminated string and their byte positions

Iterator over the characters of a null-terminated string

Iterator over the elements of a null-terminated array

Iterator over the elements of a mutable null-terminated array

Generic unsized null-terminated array

Null-terminated UTF-8 encoded string

Functions

Cast.