Snap for 11841552 from da4203ceed5c6c40e5a989c67e8825ca93dba2b6 to sdk-release

Change-Id: I0ba141a9892cda2cb68da1e9c7c345156373a741
tree: a7fc5de1049fde45ce90f3fa763b539fce37b758
  1. patches/
  2. src/
  3. test/
  4. .cargo_vcs_info.json
  5. .gitignore
  6. Android.bp
  7. build.rs
  8. Cargo.toml
  9. Cargo.toml.orig
  10. cargo_embargo.json
  11. CHANGELOG.md
  12. LICENSE
  13. METADATA
  14. module_block.bp.fragment
  15. MODULE_LICENSE_MIT
  16. OWNERS
  17. README.md
  18. TEST_MAPPING
README.md

Rust bindings to *nix APIs

Cirrus Build Status crates.io maintenance-status

Documentation (Releases)

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>;

Supported Platforms

nix target support consists of three 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:

  • Tier 1 - Builds and tests for this target are run in CI. Failures of either block the inclusion of new code.
  • Tier 2 - Builds for this target are run in CI. Failures during the build blocks the inclusion of new code. Tests may be run, but failures in tests don't block the inclusion of new code.
  • Tier 3 - Builds for this target are run in CI. Failures during the build do not necessarily block the inclusion of new code. That is, at our discretion a Tier 3 target may be dropped at any time, if it would otherwise block development.

Platforms not listed are supported on a best-effort basis, relying on our users to report any problems.

The following targets are supported by nix:

Minimum Supported Rust Version (MSRV)

nix is supported on Rust 1.69 and higher. Its MSRV will not be changed in the future without bumping the major or minor version.

Contributing

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.

License

Nix is licensed under the MIT license. See LICENSE for more details.