use core::any::{Any, TypeId};12/// Checks if the current type "is" another type, using a [`TypeId`] equality comparison.3pub trait Is {4/// Checks if the current type "is" another type, using a [`TypeId`] equality comparison.5/// This is most useful in the context of generic logic.6///7/// ```8/// # use bevy_reflect::Is;9/// # use std::any::Any;10/// fn greet_if_u32<T: Any>() {11/// if T::is::<u32>() {12/// println!("Hello");13/// }14/// }15/// // this will print "Hello"16/// greet_if_u32::<u32>();17/// // this will not print "Hello"18/// greet_if_u32::<String>();19/// assert!(u32::is::<u32>());20/// assert!(!usize::is::<u32>());21/// ```22fn is<T: Any>() -> bool;23}2425impl<A: Any> Is for A {26#[inline]27fn is<T: Any>() -> bool {28TypeId::of::<A>() == TypeId::of::<T>()29}30}313233