Skip to content

Issue with read! & serde_json::Result #21

@scraggelz

Description

@scraggelz

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`


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions