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

fix(model): Unavailable guild must always have unavailable as true #2361

Merged
merged 7 commits into from
Sep 8, 2024

Conversation

Erk-
Copy link
Member

@Erk- Erk- commented Jul 8, 2024

This adds a new construct that can be used to only deserialize a
specific boolean value. We then use that value to ensure that only
guilds which are actually unavailable get deserialized as such.

@github-actions github-actions bot added c-model Affects the model crate t-fix Fixes a bug in the library labels Jul 8, 2024
Unavailable(UnavailableGuild),
Available(Guild),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the ordering intentionally changed

Copy link
Member Author

@Erk- Erk- Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as a available guild can't be parsed as a unavailable guild anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so here, the ordering of the enum is semantically significant? does serde try to deserialize each variant in order?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes serde will try them in order when it is untagged.

twilight-model/src/util/mustbe.rs Show resolved Hide resolved
This adds a new construct that can be used to only deserialize a
specific boolean value. We then use that value to ensure that only
guilds which are actually unavailable get deserialized as such.
@github-actions github-actions bot added the c-cache Affects the cache crate label Sep 4, 2024
@github-actions github-actions bot removed the c-cache Affects the cache crate label Sep 4, 2024
@Erk- Erk- merged commit f58b540 into main Sep 8, 2024
9 checks passed
@Erk- Erk- deleted the erk/fix-guild-create branch September 8, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-model Affects the model crate t-fix Fixes a bug in the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants