| 1 | mod dispatch; |
| 2 | mod seq; |
| 3 | |
| 4 | #[cfg (test)] |
| 5 | macro_rules! assert_parse( |
| 6 | ($left: expr, $right: expr) => { |
| 7 | let res: $crate::error::ModalResult<_, $crate::error::InputError<_>> = $left; |
| 8 | snapbox::assert_data_eq!(snapbox::data::ToDebug::to_debug(&res), $right); |
| 9 | }; |
| 10 | ); |
| 11 | |
| 12 | macro_rules! impl_partial_eq { |
| 13 | ($lhs:ty, $rhs:ty) => { |
| 14 | #[allow(unused_lifetimes)] |
| 15 | impl<'a> PartialEq<$rhs> for $lhs { |
| 16 | #[inline] |
| 17 | fn eq(&self, other: &$rhs) -> bool { |
| 18 | let l = self.as_ref(); |
| 19 | let r: &Self = other.as_ref(); |
| 20 | PartialEq::eq(l, r) |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | #[allow(unused_lifetimes)] |
| 25 | impl<'a> PartialEq<$lhs> for $rhs { |
| 26 | #[inline] |
| 27 | fn eq(&self, other: &$lhs) -> bool { |
| 28 | PartialEq::eq(other, self) |
| 29 | } |
| 30 | } |
| 31 | }; |
| 32 | } |
| 33 | |
| 34 | macro_rules! impl_partial_ord { |
| 35 | ($lhs:ty, $rhs:ty) => { |
| 36 | #[allow(unused_lifetimes)] |
| 37 | impl<'a> PartialOrd<$rhs> for $lhs { |
| 38 | #[inline] |
| 39 | fn partial_cmp(&self, other: &$rhs) -> Option<Ordering> { |
| 40 | let l = self.as_ref(); |
| 41 | let r: &Self = other.as_ref(); |
| 42 | PartialOrd::partial_cmp(l, r) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | #[allow(unused_lifetimes)] |
| 47 | impl<'a> PartialOrd<$lhs> for $rhs { |
| 48 | #[inline] |
| 49 | fn partial_cmp(&self, other: &$lhs) -> Option<Ordering> { |
| 50 | PartialOrd::partial_cmp(other, self) |
| 51 | } |
| 52 | } |
| 53 | }; |
| 54 | } |
| 55 | |
| 56 | #[cfg (test)] |
| 57 | mod tests; |
| 58 | |