Skip to content

Support for cfg_attr (aka conditional derive)#235

Open
greyblake wants to merge 8 commits intomasterfrom
cfg-attr-v2
Open

Support for cfg_attr (aka conditional derive)#235
greyblake wants to merge 8 commits intomasterfrom
cfg-attr-v2

Conversation

@greyblake
Copy link
Owner

Addresses #188

This allows conditional derive of traits with cfg_attr(..). Works with derive and derive_unchecked.

Example

#[nutype(
    validate(not_empty),
    derive(Debug, Clone, PartialEq, Eq, AsRef),
    cfg_attr(feature = "serde", derive(Serialize, Deserialize)),
)]
pub struct Email(String);

@greyblake greyblake mentioned this pull request Feb 13, 2026
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

Successfully merging this pull request may close these issues.

1 participant