2019-05-16 00:58:44 +02:00
|
|
|
use std::any::Any;
|
2019-05-10 18:59:12 +02:00
|
|
|
|
2019-05-15 18:12:38 +02:00
|
|
|
pub trait Type {
|
|
|
|
fn as_any(&self) -> &dyn Any;
|
|
|
|
fn equal(&self, other: &dyn Type) -> bool;
|
|
|
|
}
|
2019-05-10 18:59:12 +02:00
|
|
|
|
2019-05-15 18:12:38 +02:00
|
|
|
#[derive(Eq, PartialEq)]
|
|
|
|
pub struct AnyShell;
|
|
|
|
|
|
|
|
impl Type for AnyShell {
|
|
|
|
fn as_any(&self) -> &dyn Any {
|
|
|
|
self as &dyn Any
|
|
|
|
}
|
|
|
|
|
|
|
|
fn equal(&self, other: &dyn Type) -> bool {
|
|
|
|
other.as_any().is::<AnyShell>()
|
|
|
|
}
|
|
|
|
}
|