repr_offset/
internal_macros.rs
1macro_rules! impl_cmp_traits_for_offset {
2 ( impl[$($impl_params:tt)*] $self:ty ) => (
3 mod __implementing_cmp_traits{
4 use super::*;
5 use core::cmp::{PartialEq,Eq,PartialOrd,Ord,Ordering};
6
7 impl<$($impl_params)*> PartialEq for $self {
8 fn eq(&self, other: &Self)->bool{
9 self.offset==other.offset
10 }
11 }
12 impl<$($impl_params)*> Eq for $self {}
13
14 impl<$($impl_params)*> PartialOrd for $self {
15 fn partial_cmp(&self, other: &Self)->Option<Ordering>{
16 self.offset.partial_cmp(&other.offset)
17 }
18 }
19
20 impl<$($impl_params)*> Ord for $self {
21 fn cmp(&self, other: &Self)->Ordering{
22 self.offset.cmp(&other.offset)
23 }
24 }
25 }
26 )
27}