Skip to content

Commit

Permalink
Remove patch left in for current to stay non-breaking (serenity-rs#…
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomedDev committed Mar 13, 2024
1 parent 8d4a338 commit 6bbc8a9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
2 changes: 0 additions & 2 deletions src/model/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ pub struct BotGateway {
#[non_exhaustive]
pub struct Activity {
/// The ID of the application for the activity.
#[serde(deserialize_with = "deserialize_buggy_id")]
#[serde(default)]
pub application_id: Option<ApplicationId>,
/// Images for the presence and their texts.
pub assets: Option<ActivityAssets>,
Expand Down
15 changes: 0 additions & 15 deletions src/model/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,6 @@ where
remove_from_map_opt(map, key)?.ok_or_else(|| serde::de::Error::missing_field(key))
}

/// Workaround for Discord sending 0 value Ids as default values.
/// This has been fixed properly on next by swapping to a NonMax based impl.
pub fn deserialize_buggy_id<'de, D, Id>(deserializer: D) -> StdResult<Option<Id>, D::Error>
where
D: Deserializer<'de>,
Id: From<u64>,
{
if let Some(val) = Option::<StrOrInt<'de>>::deserialize(deserializer)? {
let val = val.parse().map_err(serde::de::Error::custom)?;
Ok(NonZeroU64::new(val).map(Id::from))
} else {
Ok(None)
}
}

pub(super) struct CowStr<'de>(pub Cow<'de, str>);

impl<'de> serde::Deserialize<'de> for CowStr<'de> {
Expand Down

0 comments on commit 6bbc8a9

Please sign in to comment.