Trait any_key::AnyHash
[−]
[src]
pub trait AnyHash: Any { fn debug(&self, f: &mut Formatter) -> Result; fn eq(&self, other: &AnyHash) -> bool; fn hash(&self, hasher: &mut Hasher); }
Object-safe trait for dynamically typed hashable keys.
All Eq + Hash + 'static
types automatically implement this trait.
On nightly, if the inner value implements Debug
, then Debug
for
AnyHash
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: &AnyHash) -> bool
fn hash(&self, hasher: &mut Hasher)
Methods
impl AnyHash
fn is<T: AnyHash>(&self) -> bool
Returns true if the boxed type is the same as T
fn downcast_ref<T: AnyHash>(&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: AnyHash>(&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: AnyHash>(&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: AnyHash>(&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 AnyHash
fn downcast<T: AnyHash>(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: AnyHash>(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 AnyHash
[src]
impl Debug for AnyHash + Send
[src]
impl Debug for AnyHash + Send + Sync
[src]
impl PartialEq for AnyHash
[src]
fn eq(&self, other: &Self) -> bool
[src]
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[src]
This method tests for !=
.
impl PartialEq for AnyHash + Send
[src]
fn eq(&self, other: &Self) -> bool
[src]
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[src]
This method tests for !=
.
impl PartialEq for AnyHash + Send + Sync
[src]
fn eq(&self, other: &Self) -> bool
[src]
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[src]
This method tests for !=
.
impl Eq for AnyHash
[src]
impl Eq for AnyHash + Send
[src]
impl Eq for AnyHash + Send + Sync
[src]
impl Hash for AnyHash
[src]
fn hash<H: Hasher>(&self, hasher: &mut H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Hash for AnyHash + Send
[src]
fn hash<H: Hasher>(&self, hasher: &mut H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Hash for AnyHash + Send + Sync
[src]
fn hash<H: Hasher>(&self, hasher: &mut H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more