#[repr(transparent)]pub struct Reverse<T>(pub T);
Expand description
A helper struct for reverse ordering.
This struct is a helper to be used with functions like Vec::sort_by_key
and
can be used to reverse order a part of a key.
§Examples
Tuple Fields§
§0: T
Trait Implementations§
1.19.0 · Source§impl<T: Eq> Eq for Reverse<T>
impl<T: Eq> Eq for Reverse<T>
#[doc(hidden)] fn assert_receiver_is_total_eq(&self)
1.19.0 · Source§impl<T: Ord> Ord for Reverse<T>
impl<T: Ord> Ord for Reverse<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.19.0 · Source§impl<T: PartialOrd> PartialOrd for Reverse<T>
impl<T: PartialOrd> PartialOrd for Reverse<T>
Source§#[doc(hidden)] fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods
)If
self == other
, returns ControlFlow::Continue(())
.
Otherwise, returns ControlFlow::Break(self < other)
. Read moreSource§#[doc(hidden)] fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods
)Same as
__chaining_lt
, but for <=
instead of <
.Source§#[doc(hidden)] fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods
)Same as
__chaining_lt
, but for >
instead of <
.Source§#[doc(hidden)] fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>
🔬This is a nightly-only experimental API. (
partial_ord_chaining_methods
)Same as
__chaining_lt
, but for >=
instead of <
.impl<T: Copy> Copy for Reverse<T>
impl<T> StructuralPartialEq for Reverse<T>
Auto Trait Implementations§
impl<T> Freeze for Reverse<T>where
T: Freeze,
impl<T> RefUnwindSafe for Reverse<T>where
T: RefUnwindSafe,
impl<T> Send for Reverse<T>where
T: Send,
impl<T> Sync for Reverse<T>where
T: Sync,
impl<T> Unpin for Reverse<T>where
T: Unpin,
impl<T> UnsafeUnpin for Reverse<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Reverse<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)The largest safe length for a
[Self]
. Read more