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///     let secure_env_var = get_secure_var_or("SECURE_ENV_VAR", "/path/to/key_file", "Default")?;
16///     
17///     let dataview = Dataview::builder()
18///         .set_row_header("Process")
19///         .add_headline("Hostname", &hostname::get().unwrap_or_default().to_string_lossy())
20///         .add_headline("Timestamp", &chrono::Utc::now().to_rfc3339())
21///         .add_headline("Clear Env Var", &clear_env_var)
22///         .add_headline("Secure Env Var", &secure_env_var)
23///         .add_value("process1", "Status", "Running")
24///         .add_value("process1", "CPU", "2.5%")
25///         .add_value("process1", "Memory", "150MB")
26///         .build()?;
27///
28///     println!("{}", dataview);
29///     Ok(())
30/// }
31/// ```
32pub mod dataview;
33pub mod env;
34
35pub mod prelude {
36    pub use crate::dataview::{Dataview, Row, print_result_and_exit};
37    pub use crate::env::{get_secure_var, get_secure_var_or, get_var, get_var_or};
38}