Trait any_key::AnyOrd
[−]
[src]
pub trait AnyOrd: Any { fn debug(&self, f: &mut Formatter) -> Result; fn eq(&self, other: &AnyOrd) -> bool; fn cmp(&self, other: &AnyOrd) -> Ordering; }
Object-safe trait for dynamically typed totally ordered keys.
All Ord + 'static
types automatically implement this trait.
On nightly, if the inner value implements Debug
, then Debug
for
AnyOrd
will use that implementation. Otherwise, it will only show a
generic message.
Required Methods
fn debug(&self, f: &mut Formatter) -> Result
fn eq(&self, other: &AnyOrd) -> bool
fn cmp(&self, other: &AnyOrd) -> Ordering
Methods
impl AnyOrd
fn is<T: AnyOrd>(&self) -> bool
Returns true if the boxed type is the same as T
fn downcast_ref<T: AnyOrd>(&self) -> Option<&T>
Returns some reference to the boxed value if it is of type T
, or
None
if it isn't.
unsafe fn downcast_ref_unchecked<T: AnyOrd>(&self) -> &T
Returns a reference to the boxed value, blindly assuming it to be of type T
.
If you are not absolutely certain of T
, you must not call this.
fn downcast_mut<T: AnyOrd>(&mut self) -> Option<&mut T>
Returns some mutable reference to the boxed value if it is of type T
, or
None
if it isn't.
unsafe fn downcast_mut_unchecked<T: AnyOrd>(&mut self) -> &mut T
Returns a mutable reference to the boxed value, blindly assuming it to be of type T
.
If you are not absolutely certain of T
, you must not call this.
impl AnyOrd
fn downcast<T: AnyOrd>(self: Box<Self>) -> Result<Box<T>, Box<Self>>
Returns the boxed value if it is of type T
, or Err(Self)
if it isn't.
unsafe fn downcast_unchecked<T: AnyOrd>(self: Box<Self>) -> Box<T>
Returns the boxed value, blindly assuming it to be of type T
.
If you are not absolutely certain of T
, you must not call this.
Trait Implementations
impl Debug for AnyOrd
[src]
impl PartialEq for AnyOrd
[src]
fn eq(&self, other: &AnyOrd) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl Eq for AnyOrd
[src]
impl PartialOrd for AnyOrd
[src]
fn partial_cmp(&self, other: &AnyOrd) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for AnyOrd
[src]
fn cmp(&self, other: &AnyOrd) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
ord_max_min
)Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
ord_max_min
)Compares and returns the minimum of two values. Read more
Implementors
impl<T: Ord + 'static> AnyOrd for T