-
Notifications
You must be signed in to change notification settings - Fork 29
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
fix: fix serialization of InlineQueryResult #230
Conversation
@@ -22,6 +22,7 @@ async-telegram-trait = ["dep:async-trait"] | |||
|
|||
[lints.rust] | |||
unsafe_code = "forbid" | |||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rust_analyzer)'] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Veetaha might interest this. There is also elastio/bon#212 which might be similar / related. 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a regression on nightly only. It was worked around in a 3.0.2
version. I think you can upgrade to this version without a migration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be its own PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there is a dependabot PR #229
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be its own PR?
To extend to that, this only fails on nightly so I would just ignore this for this PR and remove this change. A bon patch is there, and I could also see rust_analyzer
being added to the list of well known values. So a change in this repo seems in the wrong place either way.
src/api_params.rs
Outdated
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] | ||
#[serde(untagged)] | ||
pub enum InlineQueryResultAudioOrCachedAudio { | ||
CachedAudio(InlineQueryResultCachedAudio), | ||
Audio(InlineQueryResultAudio), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a bunch of repetition 🤔
But also not that much that a macro might be really worth it. Can there be a generic type? Is that useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes. but I will be able to experiment on this only on weekend. you can push to this pr as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EdJoPaTo actually creating enum was easier than I thought. It seems you don't have to provide types for generics in enum 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the Either enum! Just not entirely sure how well it can be used in code. It also shows up randomly in the docs with not much docs so its kinda vague… Maybe naming it MaybeCached
or something to clear up the intention of it?
Generally its used when creating the inline query results to be shown so the user knows whether its cached or not and picks one of them. So they know which struct to pick. Not sure how to improve the handling of that. Maybe with Into
?
Co-authored-by: EdJoPaTo <rfc-conform-git-commit-email@funny-long-domain-label-everyone-hates-as-it-is-too-long.edjopato.de>
Co-authored-by: EdJoPaTo <rfc-conform-git-commit-email@funny-long-domain-label-everyone-hates-as-it-is-too-long.edjopato.de>
No description provided.