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

0.1.4 breaks Serde support #10

Closed
russellbanks opened this issue Mar 10, 2024 · 1 comment
Closed

0.1.4 breaks Serde support #10

russellbanks opened this issue Mar 10, 2024 · 1 comment

Comments

@russellbanks
Copy link

In 0.1.3, I was using oxilangtag = { version = "0.1.3", features = ["serde"] }. This no longer works in 0.1.4 as it's been changed to dep:serde in ac33682.

I noticed that the feature for serde support is called serialize, so I changed the feature to that - oxilangtag = { version = "0.1.4", features = ["serialize"] }. However, the actual code is gated behind the feature serde which can no longer be enabled in 0.1.4. For example:

#[cfg(feature = "serde")]
impl<T: Serialize> Serialize for LanguageTag<T> {
    fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        self.tag.serialize(serializer)
    }
}

#[cfg(feature = "serde")]
impl<'de, T: Deref<Target = str> + Deserialize<'de>> Deserialize<'de> for LanguageTag<T> {
    fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<LanguageTag<T>, D::Error> {
        use serde::de::Error;

        Self::parse(T::deserialize(deserializer)?).map_err(D::Error::custom)
    }
}

Either the feature to enable serde support should be called serde or instances of #[cfg(feature = "serde")] should be changed to #[cfg(feature = "serialize")].

Tpt added a commit that referenced this issue Mar 10, 2024
Tpt added a commit that referenced this issue Mar 10, 2024
Tpt added a commit that referenced this issue Mar 10, 2024
@Tpt
Copy link
Contributor

Tpt commented Mar 10, 2024

Thank you for this amazing bug report and sorry for that! It's sad that semver-checks has no support for features yet. This should be fixed in v0.1.5.

@Tpt Tpt closed this as completed Mar 23, 2024
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