Clean up some Value/Bool/Char code

This commit is contained in:
Eryn Wells 2017-04-08 16:35:11 -07:00
parent 27f1fb63ea
commit c2ac6450ba
4 changed files with 20 additions and 37 deletions

View file

@ -5,8 +5,13 @@
use std::fmt::Debug;
use std::any::Any;
pub trait Value: Debug + ValueEq + IsBool + IsChar {
pub trait Value: Debug + ValueEq {
fn as_value(&self) -> &Value;
/// Should return `true` if this Value is a Bool.
fn is_bool(&self) -> bool { false }
/// Should return `true` if this Value is a Char.
fn is_char(&self) -> bool { false }
}
/// A trait on value types that makes it easier to compare values of disparate types. The methods
@ -21,11 +26,3 @@ impl<'lhs,'rhs> PartialEq<Value+'rhs> for Value+'lhs {
ValueEq::eq(self, other)
}
}
pub trait IsBool {
fn is_bool(&self) -> bool { false }
}
pub trait IsChar {
fn is_char(&self) -> bool { false }
}