Skip to main content

consul_rs_plus/
pkg.rs

1use std::fmt;
2use std::error::Error;
3
4#[derive(Debug)]
5pub struct CustomError (pub String);
6
7impl fmt::Display for CustomError {
8  fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9    write!(f, "CustomErr => {}", self.0)
10  }
11}
12
13pub struct Pkg{
14  debug:    bool,         // set the debug model
15}
16
17impl Pkg {
18  pub const fn new(debug: bool) -> Self {
19    Pkg{
20      debug: debug,
21    }
22  }
23
24  // pub fn debug_print(&self, s: &str) {
25  //   if self.debug {
26  //     println!("[DEBUG] --- {:?}", s);
27  //   }
28  // }
29}
30