null-terminated

Crates.ionull-terminated
lib.rsnull-terminated
version0.3.17
sourcesrc
created_at2017-12-15 10:35:06.5509
updated_at2021-12-14 21:45:55.766839
descriptionLibrary of null-terminated slices and UTF-8-encoded strings with thin references
homepage
repositoryhttps://github.com/strake/null-terminated.rs
max_upload_size
id43174
size30,753
M Farkas-Dyck (strake)

documentation

README

null-terminated

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.

License: MIT OR Apache-2.0

Commit count: 81

cargo fmt