default_impl/
lib.rs

1/// Expands to the default implementation of a trait on all the types provided
2/// # Example
3/// ```rust
4/// trait Show: Display + Sized {
5///     fn show(&self) {
6///         println!("{self}");
7///     }
8/// }
9///
10/// default_impl!(Show, u8, u16, u32, String, isize);
11/// ```
12#[macro_export]
13macro_rules! default_impl {
14    ($tr: ty,$($x: ty),*) => {
15        $(
16            impl $tr for $x {}
17        )*
18    };
19}