rust-si icon indicating copy to clipboard operation
rust-si copied to clipboard

Issue with read! & serde_json::Result

Open scraggelz opened this issue 5 years ago • 0 comments

I'm running into an issue when using serde_json's Result in the same program as text_io's read!() macro.

Here's an example:

#[macro_use] extern crate text_io;
use std::io;
use std::io::Write;

use serde::{Serialize, Deserialize};
use serde_json::{ Result, Value};



fn main() {
    print!("Enter name: ");
    std::io::stdout().flush().unwrap();
    let name :String = read!();
    println!("NAME: {}", name);
}

The compiler error is:

   |
14 |     let name :String = read!();
   |                        ^^^^^^^ the trait `std::convert::From<text_io::Error>` is not implemented for `serde_json::error::Error`


scraggelz avatar Sep 29 '19 00:09 scraggelz