geneos_toolkit/
lib.rs

1/// Geneos Toolkit library for building data samplers and integrations
2///
3/// This library provides utilities for creating Geneos Dataviews, handling environment variables
4/// (including encrypted ones), and other helpers for working with the Geneos Toolkit.
5///
6/// Rows and columns are ordered by the order in which they are first added to the `Dataview`.
7///
8/// # Example
9///
10/// ```no_run,rust
11/// use geneos_toolkit::prelude::*;
12///
13/// fn main() -> Result<(), Box<dyn std::error::Error>> {
14///     let clear_env_var = get_var_or("CLEAR_ENV_VAR", "Default")?;
15///
16///     let dataview = Dataview::builder()
17///         .set_row_header("Process")
18///         .add_headline("Hostname", &hostname::get().unwrap_or_default().to_string_lossy())
19///         .add_headline("Timestamp", &chrono::Utc::now().to_rfc3339())
20///         .add_headline("Clear Env Var", &clear_env_var)
21///         .add_value("process1", "Status", "Running")
22///         .add_value("process1", "CPU", "2.5%")
23///         .add_value("process1", "Memory", "150MB")
24///         .build()?;
25///
26///     println!("{}", dataview);
27///     Ok(())
28/// }
29/// ```
30pub mod dataview;
31pub mod env;
32
33#[cfg(feature = "secure-env")]
34pub mod secure_env;
35
36pub mod prelude {
37    pub use crate::dataview::{Dataview, Row, print_result_and_exit};
38    pub use crate::env::{get_var, get_var_or, is_encrypted};
39    #[cfg(feature = "secure-env")]
40    pub use crate::secure_env::{decrypt, get_secure_var, get_secure_var_or};
41}