hjson / hjson-rust

Hjson for Rust
https://hjson.github.io/
MIT License
97 stars 31 forks source link

from_str method failing with integer types. #16

Open whizsid opened 4 years ago

whizsid commented 4 years ago

Error occured after I passed a string that contains integer/float in the body.

Error

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Syntax("trailing characters", 1, 3)', src/libcore/result.rs:1188:5

Reproducible code

extern crate serde_hjson;

use serde_hjson::{from_str,Value};

fn main (){
    let json:Value = from_str("123").unwrap();
}

Reason

https://github.com/hjson/hjson-rust/blob/37c4be8f3a46c0b8818ad73cb0f7cbb6ced49936/hjson/src/de.rs#L130

Why this method is not implemented yet? Can you please implement this?