| 1 | # udev |
| 2 | |
| 3 | Rust port of the [`eudev`](https://github.com/eudev-project/eudev) project for interacting with the Linux `devfs` filesystem. |
| 4 | |
| 5 | The project attempts to maintain a public API as close to possible with the original C project. |
| 6 | |
| 7 | This library is an init-system independent implementation, just like `eudev`. |
| 8 | |
| 9 | ## Safety |
| 10 | |
| 11 | As much as possible, code is written in safe Rust. Some points of interaction with the Linux API require `unsafe` code. |
| 12 | |
| 13 | All `unsafe` code is wrapped in safe interfaces, and documented with `SAFETY` comments. |
| 14 | |
| 15 | There are no C dependencies. |
| 16 | |
| 17 | ## Rust API |
| 18 | |
| 19 | All Rust structs have a public API that is somewhat close to counterparts in the `eudev` library. |
| 20 | |
| 21 | See library documentation for usage. |
| 22 | |
| 23 | To generate documentation locally: |
| 24 | |
| 25 | ```bash |
| 26 | $ cd udev |
| 27 | $ cargo doc --all --open |
| 28 | ``` |
| 29 | |
| 30 | As the project matures, use-case examples will be added to doc-tests. |
| 31 | |
| 32 | - [x] [Udev](src/context.rs) context |
| 33 | - [x] [UdevList](src/list.rs) device entry lists |
| 34 | - [x] [UdevDevice](src/device.rs) kernel devices |
| 35 | - [x] [UdevMonitor](src/monitor.rs) device monitor service |
| 36 | - [x] [UdevEnumerate](src/enumerate.rs) device enumeration |
| 37 | - [x] [UdevQueue](src/queue.rs) device queue |
| 38 | - [x] [UdevHwdb](src/hwdb.rs) device hardware database persistent storage |
| 39 | - [x] [Top-level API](src/lib.rs) matches closely to original `libudev` API |
| 40 | - basis for a future C API via FFI |
| 41 | |
| 42 | ## WIP |
| 43 | |
| 44 | Currently, there is only a Rust public API. Work is still ongoing to expose remaining subsystems via the top-level API: |
| 45 | - [ ] public C API via FFI |
| 46 | - after the Rust API stabilizes, work can start on a C API |
| 47 | - some abstractions will take some work to expose safely through the FFI barrier, e.g. `Arc<Udev>` |