`serde_derive` amazingly smart

Within context like this:

1
2
3
4
5
6
#[derive(Serialize, Deserialize)]
#[serde(transparent)]
pub struct Id<T: Register> {
    id: &'static str,
    _phantom: PhantomData<T>,
}

serde_derive intelligently recognizes that there is no need to serialize _phantom and the #[serde(transparent)] flag simply works.

Licensed under CC BY-NC-SA 4.0
Last updated on Jun 25, 2025 13:28 UTC
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy