Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Upgrades and trait std::error::Error implemented for Error #9

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

RincewindWizzard
Copy link

@RincewindWizzard RincewindWizzard commented Jan 4, 2024

I had a problem using your library for a json parsing project.
Your Error type is missing the std::error:Error trait and as such cannot be used in conjunction with other arrays.
Here is an example code for my problem:

use std::fmt::{Debug, Display, Formatter};
use std::fs::File;
use qjsonrs::sync::{Stream, TokenIterator};


const EXAMPLE_JSON: &str = "./mars_weather.json";
const BUFFER_SIZE: usize = 1024;

fn main() {
    read_json().unwrap();
}

fn read_json() -> anyhow::Result<()> {
    let file = File::open(EXAMPLE_JSON)?;
    let mut stream = Stream::from_read(file)?;

    loop {
        match stream.next()? {
            None => {
                break;
            }
            Some(x) => {
                println!("Token: {:?}", x);
            }
        }
    }
    Ok(())
}

I added the missing trait and updated the dependencies and toolchain as the project ist currently rather staled.

Thanks for your work and a happy new year!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant