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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
impl OrderedBytes for str
impl OrderedBytes for u8
SAFETY: Since u8
is a single byte, there are no concerns about endian
ordering
impl OrderedBytes for CString
impl OrderedBytes for String
impl OrderedBytes for Vec<u8>
SAFETY: Same reasoning as the OrderedBytes for [u8]
impl OrderedBytes for CStr
impl OrderedBytes for OsStr
impl OrderedBytes for OsString
impl OrderedBytes for Path
impl OrderedBytes for PathBuf
impl OrderedBytes for [u8]
SAFETY: The lexicographic ordering of [u8; N]
converted to bytes is the
same as its normal representation.
impl<'a, B> OrderedBytes for Cow<'a, B>
impl<T> OrderedBytes for &Twhere
T: OrderedBytes + ?Sized,
impl<T> OrderedBytes for &mut Twhere
T: OrderedBytes + ?Sized,
impl<T> OrderedBytes for Box<T>where
T: OrderedBytes + ?Sized,
impl<T> OrderedBytes for Rc<T>where
T: OrderedBytes + ?Sized,
impl<T> OrderedBytes for Arc<T>where
T: OrderedBytes + ?Sized,
impl<T> OrderedBytes for ManuallyDrop<T>where
T: OrderedBytes + ?Sized,
impl<const N: usize> OrderedBytes for [u8; N]
SAFETY: The lexicographic ordering of [u8; N]
converted to bytes is the
same as its normal representation.