Add IsBool and IsChar to Value trait

This commit is contained in:
Eryn Wells 2017-04-03 16:27:09 -04:00
parent 149f953d11
commit 704c342a6f
2 changed files with 8 additions and 16 deletions

View file

@ -1,15 +0,0 @@
/* types/object.rs
* Eryn Wells <eryn@erynwells.me>
*/
/// `Object` is the top-level type in Scheme's world. It is abstract -- no value is of `Object`
/// type -- but all types must implement it.
pub trait Object: IsBool + IsChar { }
pub trait IsBool {
fn is_bool() -> bool { false }
}
pub trait isChar {
fn is_char() -> bool { false }
}

View file

@ -5,7 +5,7 @@
use std::fmt::Debug;
use std::any::Any;
pub trait Value: Debug + ValueEq {
pub trait Value: Debug + ValueEq + IsBool + IsChar {
fn as_value(&self) -> &Value;
}
@ -22,3 +22,10 @@ impl<'lhs,'rhs> PartialEq<Value+'rhs> for Value+'lhs {
}
}
pub trait IsBool {
fn is_bool(&self) -> bool { false }
}
pub trait IsChar {
fn is_char(&self) -> bool { false }
}