commit | 2ba47c94b3d357cd9fd1cc272b12660f30516ea6 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Sun Mar 27 09:04:37 2022 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Sun Mar 27 09:04:37 2022 +0000 |
tree | fb2abcd53c7bec252defd92f2b61bb3ddff8949d | |
parent | e533733bd9dcccbade192b6f48153af152dd2a22 [diff] | |
parent | d1a942bdc440f245e373c350a2bc7b2a88099600 [diff] |
Snap for 8364388 from d1a942bdc440f245e373c350a2bc7b2a88099600 to main-cg-testing-release Change-Id: I39b2ace029d2192d5d28319bc9a75f75d72ff46f
Nix seeks to provide friendly bindings to various *nix platform APIs (Linux, Darwin, ...). The goal is to not provide a 100% unified interface, but to unify what can be while still providing platform specific APIs.
For many system APIs, Nix provides a safe alternative to the unsafe APIs exposed by the libc crate. This is done by wrapping the libc functionality with types/abstractions that enforce legal/safe usage.
As an example of what Nix provides, examine the differences between what is exposed by libc and nix for the gethostname system call:
// libc api (unsafe, requires handling return code/errno) pub unsafe extern fn gethostname(name: *mut c_char, len: size_t) -> c_int; // nix api (returns a nix::Result<CStr>) pub fn gethostname<'a>(buffer: &'a mut [u8]) -> Result<&'a CStr>;
nix target support consists of two tiers. While nix attempts to support all platforms supported by libc, only some platforms are actively supported due to either technical or manpower limitations. Support for platforms is split into three tiers:
The following targets are supported by nix
:
Tier 1:
Tier 2:
Tier 3:
nix is supported on Rust 1.46.0 and higher. It's MSRV will not be changed in the future without bumping the major or minor version.
Contributions are very welcome. Please See CONTRIBUTING for additional details.
Feel free to join us in the nix-rust/nix channel on Gitter to discuss nix
development.
Nix is licensed under the MIT license. See LICENSE for more details.