Struct wasmer_types::lib::std::cmp::Reverse 1.19.0[−][src]
#[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
use std::cmp::Reverse; let mut v = vec![1, 2, 3, 4, 5, 6]; v.sort_by_key(|&num| (num > 3, Reverse(num))); assert_eq!(v, vec![3, 2, 1, 6, 5, 4]);
Trait Implementations
pub fn deserialize<D>(
deserializer: D
) -> Result<Reverse<T>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
pub fn deserialize<D>(
deserializer: D
) -> Result<Reverse<T>, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
[src]Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for Reverse<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Reverse<T> where
T: UnwindSafe,
Blanket Implementations
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Converts some archived metadata to the pointer metadata for itself.
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.