Bunch of work on types
- Comment out a bunch of types modules for now - Implement fmt::Display on Object (this breaks the build because Number doesn't implement Display yet) - Move all the Is* traits to predicates.rs Haven't run tests yet because they won't build...
This commit is contained in:
parent
d63eef3da0
commit
beb32bf2ce
3 changed files with 107 additions and 33 deletions
31
types/src/predicates.rs
Normal file
31
types/src/predicates.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/* types/src/predicates.rs
|
||||
* Eryn Wells <eryn@erynwells.me>
|
||||
*/
|
||||
|
||||
pub trait IsNull {
|
||||
/// Is this thing null?
|
||||
fn is_null(&self) -> bool { false }
|
||||
}
|
||||
|
||||
pub trait IsBool {
|
||||
/// Is this thing a boolean?
|
||||
fn is_bool(&self) -> bool { false }
|
||||
}
|
||||
|
||||
pub trait IsChar {
|
||||
/// Is this thing a char?
|
||||
fn is_char(&self) -> bool { false }
|
||||
}
|
||||
|
||||
pub trait IsNumber {
|
||||
/// Is this thing a number?
|
||||
fn is_number(&self) -> bool { self.is_complex() || self.is_real() || self.is_rational() || self.is_integer() }
|
||||
/// Should return `true` if this Value is a complex number type.
|
||||
fn is_complex(&self) -> bool { self.is_real() }
|
||||
/// Should return `true` if this Value is a real number type.
|
||||
fn is_real(&self) -> bool { self.is_rational() }
|
||||
/// Should return `true` if this Value is a rational number type.
|
||||
fn is_rational(&self) -> bool { self.is_integer() }
|
||||
/// Should return `true` if this Value is a integer number type.
|
||||
fn is_integer(&self) -> bool { false }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue