peach-workspace/peach-network/src/lib.rs

48 lines
1.4 KiB
Rust

#![warn(missing_docs)]
//! # peach-network
//!
//! Network interface state query and modification library; designed for use
//! with the PeachCloud platform.
//!
//! The `src/network.rs` module contains the core networking logic and data
//! types for interacting with the `wpa_supplicant` process and related parts of
//! the operating system, while the `src/error.rs` module contains
//! error-handling data types and methods.
//!
//! ## Example Usage
//!
//! ```rust
//! use peach_network::{network, NetworkError, network::WiFi};
//!
//! fn main() -> Result<(), NetworkError> {
//! let ip = network::ip("wlan0");
//! let ssid = network::ssid("wlan0");
//!
//! let new_ap = WiFi { ssid: "Home".to_string(), pass: "SuperSecret".to_string() };
//!
//! //network::add(&new_ap)?;
//! //network::save()?;
//!
//! Ok(())
//! }
//! ```
//!
//! ## Feature Flags
//!
//! Feature flags are used to offer `Serialize` and `Deserialize` implementations
//! for all `struct` data types provided by this library. These traits are not
//! provided by default. A choice of `miniserde` and `serde` is provided.
//!
//! Define the desired feature in the `Cargo.toml` manifest of your project:
//!
//! ```toml
//! peach-network = { version = "0.3.0", features = ["miniserde_support"] }
//! ```
pub mod error;
pub mod network;
mod utils;
pub use crate::error::NetworkError;