0.5.2: singleton!
[0.5.2] — 2022-10-06
- Add
singleton!
macro (#25)
use std::fmt;
fn main() {
let world = "world";
let says_hello_world = impl_tools::singleton! {
struct(&'static str = world);
impl fmt::Display for Self {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "hello {}", self.0)
}
}
};
assert_eq!(format!("{}", says_hello_world), "hello world");
}