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

Integration with Serde #9

Open
amab8901 opened this issue Jul 24, 2024 · 2 comments
Open

Integration with Serde #9

amab8901 opened this issue Jul 24, 2024 · 2 comments

Comments

@amab8901
Copy link

amab8901 commented Jul 24, 2024

I have a struct containing a serde_json::Value field like this:

use dbg_pls::{color, DebugPls};
use serde_json::Value;

fn main() {
    let expr = Structer::default();
    color!(expr);
}

#[derive(Default, Clone, DebugPls)]
struct Structer {
    pub field1: Value,
    pub field2: u32,
    pub field3: Vec<bool>,
}

Orphan rule doesn't let me apply DebugPls on serde_json::Value. Can you apply it (behind a serde feature)?

I think it's good to also apply std dbg! as a fallback for cases where I wanna use a 3rd party type for which DebugPls hasn't been implemented

@conradludgate
Copy link
Owner

Sounds reasonable

@amab8901
Copy link
Author

I have an idea! maybe you could use generics in the DebugPls trait, such that it's automatically implemented on every type that implements Debug? That way, we can get around the orphan rule so that DebugPls automatically works whenever Debug works, especially for 3rd party crates

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

No branches or pull requests

2 participants