Skip to content

Support for cfg_attr (aka conditional derive)#235

Merged
greyblake merged 16 commits intomasterfrom
cfg-attr-v2
Feb 26, 2026
Merged

Support for cfg_attr (aka conditional derive)#235
greyblake merged 16 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
@greyblake greyblake merged commit 7464ec7 into master Feb 26, 2026
6 checks passed
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