fixed od builting parsing
This commit is contained in:
parent
d87286c5c3
commit
32cc0bddf6
@ -63,11 +63,11 @@ impl Builtin {
|
|||||||
|
|
||||||
/// Create a builtin from JSON.
|
/// Create a builtin from JSON.
|
||||||
///
|
///
|
||||||
/// JSON must be of the form `{ "name": "identity", "linear": {"base": 10, "word": 20} }`.
|
/// JSON must be of the form `{ "name": "identity", "pricing": {"base": 10, "word": 20} }`.
|
||||||
pub fn from_json(json: &Json) -> Option<Builtin> {
|
pub fn from_json(json: &Json) -> Option<Builtin> {
|
||||||
// NICE: figure out a more convenient means of handing errors here.
|
// NICE: figure out a more convenient means of handing errors here.
|
||||||
if let Json::String(ref name) = json["name"] {
|
if let Json::String(ref name) = json["name"] {
|
||||||
if let Json::Object(ref o) = json["linear"] {
|
if let Json::Object(ref o) = json["pricing"] {
|
||||||
if let Json::U64(ref word) = o["word"] {
|
if let Json::U64(ref word) = o["word"] {
|
||||||
if let Json::U64(ref base) = o["base"] {
|
if let Json::U64(ref base) = o["base"] {
|
||||||
return Self::from_named_linear(&name[..], *base as usize, *word as usize);
|
return Self::from_named_linear(&name[..], *base as usize, *word as usize);
|
||||||
|
Loading…
Reference in New Issue
Block a user