Define a Constant node for constants
This commit is contained in:
parent
8f2a93f813
commit
4cfd0510e6
1 changed files with 15 additions and 1 deletions
|
@ -2,4 +2,18 @@
|
|||
* Eryn Wells <eryn@erynwells.me>
|
||||
*/
|
||||
|
||||
use types::boolean::Boolean;
|
||||
use types::{Boolean, Number};
|
||||
|
||||
trait ConstantValue {}
|
||||
impl ConstantValue for Boolean {}
|
||||
impl ConstantValue for Number {}
|
||||
|
||||
struct Constant<V: ConstantValue> {
|
||||
value: V
|
||||
}
|
||||
|
||||
impl<V: ConstantValue> Constant<V> {
|
||||
fn new(value: V) -> Constant<V> {
|
||||
Constant { value: value }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue