Implement NonIntegerConstant::into_typed_value. r=jsantell
This commit is contained in:
parent
1aa33423dc
commit
fc73bfce75
|
@ -6,3 +6,6 @@ version = "0.0.1"
|
|||
|
||||
[dependencies.edn]
|
||||
path = "../edn"
|
||||
|
||||
[dependencies.mentat_core]
|
||||
path = "../core"
|
||||
|
|
|
@ -31,9 +31,11 @@
|
|||
///! a tradeoff against well-typed function signatures and other such boundaries.
|
||||
|
||||
extern crate edn;
|
||||
extern crate mentat_core;
|
||||
|
||||
use edn::{BigInt, OrderedFloat};
|
||||
pub use edn::{NamespacedKeyword, PlainSymbol};
|
||||
use mentat_core::TypedValue;
|
||||
|
||||
pub type SrcVarName = String; // Do not include the required syntactic '$'.
|
||||
|
||||
|
@ -101,6 +103,17 @@ pub enum NonIntegerConstant {
|
|||
Text(String),
|
||||
}
|
||||
|
||||
impl NonIntegerConstant {
|
||||
pub fn into_typed_value(self) -> TypedValue {
|
||||
match self {
|
||||
NonIntegerConstant::BigInteger(_) => unimplemented!(), // TODO: #280.
|
||||
NonIntegerConstant::Boolean(v) => TypedValue::Boolean(v),
|
||||
NonIntegerConstant::Float(v) => TypedValue::Double(v),
|
||||
NonIntegerConstant::Text(v) => TypedValue::String(v),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum FnArg {
|
||||
Variable(Variable),
|
||||
SrcVar(SrcVar),
|
||||
|
|
Loading…
Reference in a new issue