pub mod cheap_eq;
pub(crate) use sealed::WidgetEqOS;
mod sealed {
use crate::{api::AnyExt, macro_exports::CheapEq};
pub trait WidgetEqOS {
fn eq(&self, other: &dyn AnyExt) -> bool;
}
impl<T: CheapEq> WidgetEqOS for T {
fn eq(&self, other: &dyn AnyExt) -> bool {
unsafe {
match other.downcast_ref::<T>() {
Some(other) => <T as CheapEq>::cheap_eq(self, other),
None => {
eprintln!(
"WidgetEqOS: can't compare widgets of different types. This is a bug."
);
false
}
}
}
}
}
}