-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add way to display Value
nicely
#366
Comments
@SeaDve Thanks. Actually I also get annoyed with the output but I think it's the BTW for unique names like |
Thanks, but it is unfortunately out of control for me here since the variant came from unknown sources.
I agree. So, to clarify, I think what we want here is to reimplement something like |
What encoding comes from is not relevant here. You use that type on your side and from encoding pov it's all strings underneath still. You get type safety that way. There is also
Yes. If you do, it would be good to all to other types too (also the types in |
I got the structure from the body of a |
Ah it's very generic code. Nm then. :) |
I think
|
Also, I'm not sure if it's possible with |
Hmm.. that's a good point.
This too. :) @SeaDve Sorry to have sent you in the wrong direction but I think switching from Display to Debug shouldn't be a huge effort? |
And yes, tbc @MaxVerevkin convinced me that your original suggestion of modifying the Debug impl was the way to go. Sorry again. |
Don't worry about it
Yeah, it shouldn't be difficult (Can be done I guess simply by replacing
It's possible for both |
Is the
|
Not much for me, but the compatibility may be useful on some scenario like parsing
Hmm, we also have an option of doing that with the |
Hm, could you elaborate please? Why would anyone want to parse the |
I meant it with the |
Interesting! In this particular case a |
Maybe the pub struct<'a, T> GVariantDisplay(&'a T);
impl ... {
pub fn gvarint_display(&self) -> GVariantDispay<'_, Self> {
GVariantDisplay(self)
}
}
impl Display for GVariantDisplay<...> {
...
}
impl Display for GVariantDisplay<...> {
...
} println!("{}", val.gvariant_display()); But maybe I'm over-complicating things... |
Yeah, maybe. :) I think we should just go for |
That sounds like a good plan IMO. |
So, I think we agree to keep #379 as it is and just improve the existing I could do a separate PR :) |
Yup. @MaxVerevkin ?
Probably better, yes (for the |
Seems reasonable |
I'm not sure if I missed any API, but the current nicest way to display that I know of is through its
Debug
implementation:It looks much more verbose and harder to look at compared to something from
GVariant
throughg_variant_print
:I would be willing to submit a pull request for the reimplementation of
GVariant
printing style onzvariant::Value
if that will be fine.The text was updated successfully, but these errors were encountered: