Add IsBool and IsChar to Value trait
This commit is contained in:
parent
149f953d11
commit
704c342a6f
2 changed files with 8 additions and 16 deletions
|
@ -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 }
|
||||
}
|
|
@ -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 }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue