Skip to content

Commit be752ba

Browse files
committed
der: provide a noop implementation for PhantomData
similar to #1009, provide a `der::DerOrd` and a `der::ValueOrd` noop implementation for PhantomData
1 parent 86baf66 commit be752ba

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

der/src/ord.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Ordering trait.
22
33
use crate::{EncodeValue, Result, Tagged};
4-
use core::cmp::Ordering;
4+
use core::{cmp::Ordering, marker::PhantomData};
55

66
/// DER ordering trait.
77
///
@@ -69,3 +69,17 @@ where
6969

7070
Ok(length_ord)
7171
}
72+
73+
/// Provide a no-op implementation for PhantomData
74+
impl<T> ValueOrd for PhantomData<T> {
75+
fn value_cmp(&self, _other: &Self) -> Result<Ordering> {
76+
Ok(Ordering::Equal)
77+
}
78+
}
79+
80+
/// Provide a no-op implementation for PhantomData
81+
impl<T> DerOrd for PhantomData<T> {
82+
fn der_cmp(&self, _other: &Self) -> Result<Ordering> {
83+
Ok(Ordering::Equal)
84+
}
85+
}

0 commit comments

Comments
 (0)