commit | 0e982ada2ee022a62ea1e66813924a475f64ded2 | [log] [tgz] |
---|---|---|
author | Matthew Maurer <mmaurer@google.com> | Thu Mar 09 19:10:05 2023 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Mar 09 19:10:05 2023 +0000 |
tree | e915b9980ec75a1f4510ec95a16a4711a31caffc | |
parent | 8705f87277f7dfa36a1bd19b76911e2354ed236e [diff] | |
parent | f120190ec670acdaf5d5982047078509d78b9909 [diff] |
Make nix available to product and vendor am: 3e85770325 am: dca9aae545 am: 25b21a099e am: ecbc9ecccf am: f120190ec6 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/nix/+/2475616 Change-Id: I75658d2cb4d1460b8eda44ee3cab83d007629422 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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<OsString>) pub fn gethostname() -> Result<OsString>;
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.56.1 and higher. Its 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.