Commit 75c1a964 authored by Jack Rickard's avatar Jack Rickard
Browse files

Add cross impls of PartialOrd/Eq for X509/X509Ref

parent 317981c6
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -616,12 +616,24 @@ impl PartialOrd for X509Ref {
    }
}

impl PartialOrd<X509> for X509Ref {
    fn partial_cmp(&self, other: &X509) -> Option<cmp::Ordering> {
        <X509Ref as PartialOrd<X509Ref>>::partial_cmp(self, other)
    }
}

impl PartialEq for X509Ref {
    fn eq(&self, other: &Self) -> bool {
        self.cmp(other) == cmp::Ordering::Equal
    }
}

impl PartialEq<X509> for X509Ref {
    fn eq(&self, other: &X509) -> bool {
        <X509Ref as PartialEq<X509Ref>>::eq(self, other)
    }
}

impl Eq for X509Ref {}

impl X509 {
@@ -736,12 +748,24 @@ impl PartialOrd for X509 {
    }
}

impl PartialOrd<X509Ref> for X509 {
    fn partial_cmp(&self, other: &X509Ref) -> Option<cmp::Ordering> {
        X509Ref::partial_cmp(self, other)
    }
}

impl PartialEq for X509 {
    fn eq(&self, other: &Self) -> bool {
        X509Ref::eq(self, other)
    }
}

impl PartialEq<X509Ref> for X509 {
    fn eq(&self, other: &X509Ref) -> bool {
        X509Ref::eq(self, other)
    }
}

impl Eq for X509 {}

/// A context object required to construct certain `X509` extension values.