| 1 | // not all are used in all features configurations |
| 2 | #![allow (unused)] |
| 3 | |
| 4 | /// Forward a method to an inherent method or a base trait method. |
| 5 | macro_rules! forward { |
| 6 | ($( Self :: $method:ident ( self $( , $arg:ident : $ty:ty )* ) -> $ret:ty ; )*) |
| 7 | => {$( |
| 8 | #[inline] |
| 9 | fn $method(self $( , $arg : $ty )* ) -> $ret { |
| 10 | Self::$method(self $( , $arg )* ) |
| 11 | } |
| 12 | )*}; |
| 13 | ($( $base:ident :: $method:ident ( self $( , $arg:ident : $ty:ty )* ) -> $ret:ty ; )*) |
| 14 | => {$( |
| 15 | #[inline] |
| 16 | fn $method(self $( , $arg : $ty )* ) -> $ret { |
| 17 | <Self as $base>::$method(self $( , $arg )* ) |
| 18 | } |
| 19 | )*}; |
| 20 | ($( $base:ident :: $method:ident ( $( $arg:ident : $ty:ty ),* ) -> $ret:ty ; )*) |
| 21 | => {$( |
| 22 | #[inline] |
| 23 | fn $method( $( $arg : $ty ),* ) -> $ret { |
| 24 | <Self as $base>::$method( $( $arg ),* ) |
| 25 | } |
| 26 | )*}; |
| 27 | ($( $imp:path as $method:ident ( self $( , $arg:ident : $ty:ty )* ) -> $ret:ty ; )*) |
| 28 | => {$( |
| 29 | #[inline] |
| 30 | fn $method(self $( , $arg : $ty )* ) -> $ret { |
| 31 | $imp(self $( , $arg )* ) |
| 32 | } |
| 33 | )*}; |
| 34 | } |
| 35 | |
| 36 | macro_rules! constant { |
| 37 | ($( $method:ident () -> $ret:expr ; )*) |
| 38 | => {$( |
| 39 | #[inline] |
| 40 | fn $method() -> Self { |
| 41 | $ret |
| 42 | } |
| 43 | )*}; |
| 44 | } |
| 45 | |