nushell/src/object/types.rs
2019-05-15 11:12:38 -05:00

20 lines
366 B
Rust

use std::any::{Any, TypeId};
pub trait Type {
fn as_any(&self) -> &dyn Any;
fn equal(&self, other: &dyn Type) -> bool;
}
#[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>()
}
}