1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//! # selinux\_configfile
//!
//! 100% safe Rust parser and writer for `/etc/selinux/config` with full
//! format preservation. Zero `unsafe` code.
//!
//! ## Features
//!
//! - **Type-safe getters/setters** for all 5 standard SELinux config keys:
//! `SELINUX`, `SELINUXTYPE`, `REQUIRESEUSERS`, `AUTORELABEL`, `SETLOCALDEFS`
//! - **Generic key-value API** for unknown or custom keys
//! - **Format preservation** — comments, indentation, inline comments, blank
//! lines, and trailing whitespace are all preserved across read–modify–write
//! cycles
//! - **Atomic writes** — write via temp file + `fsync` + rename
//! - **Zero unsafe code** — verified with `grep -r unsafe src/`
//!
//! ## Quick start
//!
//! ```rust
//! use selinux_configfile::{ConfigFile, SelinuxMode};
//!
//! // Parse an in-memory config string
//! let mut cfg = ConfigFile::parse(
//! "SELINUX=enforcing\nSELINUXTYPE=targeted\n"
//! ).unwrap();
//!
//! assert_eq!(cfg.selinux(), Some(SelinuxMode::Enforcing));
//! assert_eq!(cfg.selinuxtype(), Some("targeted"));
//!
//! // Modify values
//! cfg.set_selinux(SelinuxMode::Permissive);
//! cfg.set_selinuxtype("mls").unwrap();
//!
//! // Serialize back to string
//! let output = cfg.to_string();
//! assert!(output.contains("SELINUX=permissive"));
//! assert!(output.contains("SELINUXTYPE=mls"));
//! ```
//!
//! ## Reading and writing files
//!
//! ```rust,no_run
//! use selinux_configfile::{ConfigFile, SelinuxMode};
//!
//! // Read from the default system path (/etc/selinux/config)
//! let mut cfg = ConfigFile::read_default().unwrap();
//!
//! // Modify and write back
//! cfg.set_selinux(SelinuxMode::Permissive);
//! cfg.write_default().unwrap();
//! ```
//!
//! ## Format preservation example
//!
//! ```rust
//! use selinux_configfile::ConfigFile;
//!
//! let input = "# My config\nSELINUX = enforcing # inline comment\n";
//! let cfg = ConfigFile::parse(input).unwrap();
//! let output = cfg.to_string();
//! assert_eq!(input, output);
//! ```
pub use ConfigFile;
pub use ;
pub use ;