1pub mod Build;
7pub mod Main;
8
9pub use Build::{RuntimeBuild, ServiceRegister};
11pub use Main::Entry;
12
13#[derive(Debug, Clone)]
15pub struct BinaryConfig {
16 pub name:String,
18 pub version:String,
20 pub verbose:bool,
22 pub debug:bool,
24}
25
26impl BinaryConfig {
27 pub fn new() -> Self {
29 Self {
30 name:"grove".to_string(),
31 version:env!("CARGO_PKG_VERSION").to_string(),
32 verbose:false,
33 debug:cfg!(debug_assertions),
34 }
35 }
36
37 pub fn with_verbose(mut self, verbose:bool) -> Self {
39 self.verbose = verbose;
40 self
41 }
42
43 pub fn with_debug(mut self, debug:bool) -> Self {
45 self.debug = debug;
46 self
47 }
48}
49
50impl Default for BinaryConfig {
51 fn default() -> Self { Self::new() }
52}
53
54#[cfg(test)]
55mod tests {
56 use super::*;
57
58 #[test]
59 fn test_binary_config_default() {
60 let config = BinaryConfig::default();
61 assert_eq!(config.name, "grove");
62 assert!(!config.verbose);
63 }
64
65 #[test]
66 fn test_binary_config_builder() {
67 let config = BinaryConfig::default().with_verbose(true).with_debug(true);
68
69 assert!(config.verbose);
70 assert!(config.debug);
71 }
72}