Bug 1925561 - Use a quicker radius calculation for ArcParams. r=aosmond
[gecko.git] / third_party / rust / libudev / README.md
bloba4e99843522608bfacbf9d317995466f55c8b0df
1 # Libudev
2 This crate provides a safe wrapper around the native `libudev` library. It applies the RAII pattern
3 and Rust lifetimes to ensure safe usage of all `libudev` functionality. The RAII pattern ensures
4 that all acquired resources are released when they're no longer needed, and Rust lifetimes ensure
5 that resources are released in a proper order.
7 * [Documentation](http://dcuddeback.github.io/libudev-rs/libudev/)
9 ## Dependencies
10 In order to use the `libudev` crate, you must have a Linux system with the `libudev` library
11 installed where it can be found by `pkg-config`. To install `libudev` on Debian-based Linux
12 distributions, execute the following command:
14 ```
15 sudo apt-get install libudev-dev
16 ```
18 `libudev` is a Linux-specific package. It is not available for Windows, OS X, or other operating
19 systems.
21 ### Cross-Compiling
22 The `libudev` crate can be used when cross-compiling to a foreign target. Details on how to
23 cross-compile `libudev` are explained in the [`libudev-sys` crate's
24 README](https://github.com/dcuddeback/libudev-sys#cross-compiling).
26 ## Usage
27 Add `libudev` as a dependency in `Cargo.toml`:
29 ```toml
30 [dependencies]
31 libudev = "0.2"
32 ```
34 If you plan to support operating systems other than Linux, you'll need to add `libudev` as a
35 target-specific dependency:
37 ```toml
38 [target.x86_64-unknown-linux-gnu.dependencies]
39 libudev = "0.2"
40 ```
42 Import the `libudev` crate. The starting point for nearly all `libudev` functionality is to create a
43 context object.
45 ```rust
46 extern crate libudev;
48 fn main() {
49   let context = libudev::Context::new().unwrap();
50   let mut enumerator = libudev::Enumerator::new(&context).unwrap();
52   enumerator.match_subsystem("tty").unwrap();
54   for device in enumerator.scan_devices().unwrap() {
55     println!("found device: {:?}", device.syspath());
56   }
58 ```
60 ## Contributors
61 * [dcuddeback](https://github.com/dcuddeback)
62 * [Susurrus](https://github.com/Susurrus)
64 ## License
65 Copyright © 2015 David Cuddeback
67 Distributed under the [MIT License](LICENSE).