tree: c7bc2f09b31725651b3552e1e444e40a4bb5641e [path history] [tgz]
  1. examples/
  2. src/
  3. build.rs
  4. build_bindings.sh
  5. Cargo.toml
  6. OWNERS
  7. README.md
featured/rust-client/README.md

Featured Rust wrapper

Note: This crate is specific to ChromeOS and requires the native libfeatures_c library at link time.

featured-rs is a Rust wrapper for libfeatures_c. This library is used to interact with Featured to check which features are currently enabled.

Building for the host environment

You can also execute cargo directly for faster build and tests. This would be useful when you are developing this crate. Since this crate depends on libfeatures_c.so, you need to install it to host environment first.

# Install libfeatures_c.so to host.
(chroot)$ sudo emerge chromeos-base/featured
# Build
(chroot)$ cargo build
# Unit tests
(chroot)$ cargo test

Generated bindings

The build script, build_buildings.sh, generates bindings to ../c_feature_library.h. Whenever breaking changes are made to ../c_featured_library.h, this build script must be rerun to generate new bindings to the C library.

Running the examples on DUT

First, you need to make sure you have deployed featured to your DUT. You may also need to deploy libchrome and libbrillo to have the examples run properly.

(chroot)$ cros deploy ${DUT_IP} chromeos-base/featured

Second, you need to build them and copy them over to your device.

(chroot)$ cargo build --release --examples
(chroot)$ scp target/release/examples/*feature_check $DUT:/usr/local/bin

To run them on your DUT:

(DUT)$ feature_check
(DUT)$ fake_feature_check