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

51 lines
1.4 KiB
Rust
Raw Permalink Normal View History

2021-12-13 08:55:04 +00:00
#![warn(missing_docs)]
2021-08-06 17:58:40 +00:00
//! # peach-network
//!
2021-12-13 08:55:04 +00:00
//! Network interface state query and modification library; designed for use
//! with the PeachCloud platform.
2021-08-06 17:58:40 +00:00
//!
//! 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.
//!
2021-12-13 08:55:04 +00:00
//! ## Example Usage
//!
//! ```rust
2022-01-03 09:55:20 +00:00
//! use peach_network::{network, NetworkError};
2021-12-13 08:55:04 +00:00
//!
//! fn main() -> Result<(), NetworkError> {
2022-01-03 09:55:20 +00:00
//! let wlan_iface = "wlan0";
2021-12-13 08:55:04 +00:00
//!
2022-01-03 09:55:20 +00:00
//! let wlan_ip = network::ip(wlan_iface);
//! let wlan_ssid = network::ssid(wlan_iface);
//!
//! let ssid = "Home";
//! let pass = "SuperSecret";
2021-12-13 08:55:04 +00:00
//!
2022-01-03 09:55:20 +00:00
//! //network::add(&wlan_iface, &ssid, &pass)?;
2021-12-13 08:55:04 +00:00
//! //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:
2021-08-06 17:58:40 +00:00
//!
2021-12-13 08:55:04 +00:00
//! ```toml
//! peach-network = { version = "0.3.0", features = ["miniserde_support"] }
//! ```
pub mod error;
2021-08-06 17:58:40 +00:00
pub mod network;
mod utils;
2021-12-13 08:55:04 +00:00
pub use crate::error::NetworkError;