Macro doe::bts

source ·
macro_rules! bts {
    ($v:expr) => { ... };
}
Expand description

§implments Bts struct and bts! macro for Box<\dyn ToString> trait object

fn main() {
   use doe::DebugPrint;
   use doe::Bts;
   use doe::bts;
   let mut s:Bts =  bts!("Trait Object, it's ");
   s.push(bts!(100));
   s.push_str("% safe");
   s.dprintln();//"Trait Object, it's 100% safe"
   s.as_bytes().dprintln();//[84, 114, 97, 105, 116, 32, 79, 98, 106, 101, 99, 116, 44, 32, 105, 116, 39, 115, 32, 49, 48, 48, 37, 32, 115, 97, 102, 101]
   s.chars().dprintln();//['T', 'r', 'a', 'i', 't', ' ', 'O', 'b', 'j', 'e', 'c', 't', ',', ' ', 'i', 't', '\'', 's', ' ', '1', '0', '0', '%', ' ', 's', 'a', 'f', 'e']
   let b = Into::<Bts>::into("b".to_string());
   let b = Bts::from("demo");
}