TypeEq

Trait TypeEq 

Source
pub trait TypeEq: Sized {
    // Required methods
    fn type_hash<H: Hasher>(&self, hasher: &mut H, types: &MetaTypes);
    fn type_eq(&self, other: &Self, types: &MetaTypes) -> bool;

    // Provided methods
    fn type_hash_slice<H: Hasher>(
        slice: &[Self],
        hasher: &mut H,
        types: &MetaTypes,
    ) { ... }
    fn type_eq_iter<'a, X, Y>(x: X, y: Y, types: &MetaTypes) -> bool
       where Self: 'a,
             X: IntoIterator<Item = &'a Self>,
             Y: IntoIterator<Item = &'a Self> { ... }
}
Expand description

Trait to check if two types are equal to each other or not.

This trait will automatically resolve type definitions to its target type before it compares the two instances. This means a type is considered as equal, if all type identifiers point to the same type and all normal values are equal.

Required Methods§

Source

fn type_hash<H: Hasher>(&self, hasher: &mut H, types: &MetaTypes)

Feeds this value into the given Hasher.

Source

fn type_eq(&self, other: &Self, types: &MetaTypes) -> bool

Check if this instance is equal to the other instance using the passed types to resolve identifiers.

Provided Methods§

Source

fn type_hash_slice<H: Hasher>(slice: &[Self], hasher: &mut H, types: &MetaTypes)

Feeds a slice of this value into the given Hasher.

Source

fn type_eq_iter<'a, X, Y>(x: X, y: Y, types: &MetaTypes) -> bool
where Self: 'a, X: IntoIterator<Item = &'a Self>, Y: IntoIterator<Item = &'a Self>,

Check if the two passed iterators contain type equal elements.

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§

Source§

impl<T> TypeEq for Option<T>
where T: TypeEq,

Source§

fn type_hash<H: Hasher>(&self, hasher: &mut H, types: &MetaTypes)

Source§

fn type_eq(&self, other: &Self, types: &MetaTypes) -> bool

Implementors§