Trait blart::OrderedBytes
source · pub unsafe trait OrderedBytes: AsBytes + Ord { }
Expand description
This trait is used to mark types where the lexicographic ordering of their
byte representation (as output by AsBytes::as_bytes
) matches their
normal ordering (as determined by Ord
).
Safety
This trait can only be implemented if the above condition holds.
Implementations on Foreign Types§
impl OrderedBytes for PathBuf
impl OrderedBytes for str
impl OrderedBytes for CStr
impl<'a, B> OrderedBytes for Cow<'a, B>where B: OrderedBytes + 'a + ToOwned + ?Sized, Cow<'a, B>: AsBytes,
impl<T> OrderedBytes for Box<T>where T: OrderedBytes + ?Sized,
impl<T> OrderedBytes for Rc<T>where T: OrderedBytes + ?Sized,
impl OrderedBytes for String
impl<const N: usize, T> OrderedBytes for [T; N]where T: OrderedBytes, [T; N]: AsBytes,
SAFETY: The lexicographic ordering of [u8; N]
converted to bytes is the
same as its normal representation
impl OrderedBytes for u8
SAFETY: Since u8
is a single byte, there are no concerns about endian
ordering
impl<T> OrderedBytes for Arc<T>where T: OrderedBytes + ?Sized,
impl<'a, T> OrderedBytes for &'a mut Twhere T: OrderedBytes + ?Sized,
impl<'a, T> OrderedBytes for &'a Twhere T: OrderedBytes + ?Sized,
impl OrderedBytes for Path
impl OrderedBytes for CString
impl OrderedBytes for OsStr
impl<T> OrderedBytes for [T]where T: OrderedBytes, [T]: AsBytes,
SAFETY: The ordering of a slice is the lexicographic ordering of the elements. If each element compares the same if it is converted to bytes, then converting the entire slice to bytes should compare the same as the original slice.
impl OrderedBytes for OsString
impl<T> OrderedBytes for Vec<T>where T: OrderedBytes, Vec<T>: AsBytes,
SAFETY: Same reasoning as the OrderedBytes for [T]