Rearrange the types modules a bunch

This commit is contained in:
Eryn Wells 2017-04-03 14:51:39 -04:00
parent 82b96abd62
commit ddfac28b8c
5 changed files with 103 additions and 65 deletions

26
src/types/char.rs Normal file
View file

@ -0,0 +1,26 @@
/* types/char.rs
* Eryn Wells <eryn@erynwells.me>
*/
use std::any::Any;
use super::value::{Value, ValueEq};
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Char(char);
impl Char {
pub fn new(v: char) -> Char { Char(v) }
}
impl Value for Char {
fn as_value(&self) -> &Value { self }
}
impl ValueEq for Char {
fn eq(&self, other: &Value) -> bool {
other.as_any().downcast_ref::<Self>().map_or(false, |x| x == self)
}
fn as_any(&self) -> &Any { self }
}