Skip to content

chore(deps): update nutype requirement from 0.7 to 0.8 - #87

Merged
mt-empty merged 1 commit into
masterfrom
dependabot/cargo/nutype-0.8
Sep 26, 2026
Merged

mt-empty merged 1 commit into
masterfrom
dependabot/cargo/nutype-0.8

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Sep 25, 2026

Copy link
Copy Markdown
Contributor

Updates the requirements on nutype to permit the latest version.

Release notes

Sourced from nutype's releases.

Nutype 0.8.0 - attribute passthrough, serde customization and Decimal

What is nutype?

Nutype is a Rust proc macro for creating newtypes with guarantees.

It adds sanitization and validation to the regular newtype pattern and makes sure those invariants hold whenever a value is constructed, including through Serde deserialization.

What's new in 0.8.0?

The main theme of this release is better interoperability with the rest of the Rust ecosystem.

Attributes on the newtype and its inner field can now be passed through to third-party derives, Serde customization is supported directly, and rust_decimal::Decimal can now be used as a first-class numeric inner type.

Attribute passthrough

Previously, using third-party derives through derive_unchecked was possible, but attributes required by those derives were often lost.

In 0.8.0, attributes on the struct and inner field are forwarded to the generated type.

For example, Nutype can now play nicely with garde:

#[nutype(
    sanitize(trim),
    derive(Debug, Clone),
    derive_unchecked(garde::Validate),
)]
pub struct UserId(
    #[garde(length(min = 1))]
    String
);

Or with SQLx:

#[nutype(
    derive(Debug),
    derive_unchecked(sqlx::Type),
)]
#[sqlx(transparent)]
pub struct UserId(i64);

Attributes such as #[repr(transparent)] work as well.

Since Nutype cannot know what arbitrary attributes or third-party derives do, the same caveat as with derive_unchecked applies: it is your responsibility to ensure they do not provide a way to violate the newtype's invariants.

See #229.

... (truncated)

Changelog

Sourced from nutype's changelog.

v0.8.0 - 2026-09-20

  • [FEATURE] Attribute passthrough (see #229): attributes written on the struct and on the inner field are now forwarded verbatim onto the generated type, so they can be read by third-party derives and the compiler. Examples: #[repr(transparent)], #[sqlx(transparent)] (with derive_unchecked(sqlx::Type)), #[garde(length(min = 1))] (with derive_unchecked(garde::Validate)). Resolves #228 and the attribute half of #191.
  • [FEATURE] Serde customization (see #201): nutype's generated Serialize/Deserialize impls now honor field-level #[serde(with = "...")], #[serde(serialize_with = "...")], #[serde(deserialize_with = "...")] and struct-level #[serde(transparent)]. Sanitization and validation still always run on deserialization.
  • [FIX] Field attributes on newtypes with custom ("any") inner types no longer leak into type positions of the generated code (previously they could produce confusing compile errors).
  • [BEHAVIOR] Previously, non-doc attributes on the struct were rejected with an error and attributes on the inner field were silently dropped. Both are now forwarded (serde attributes are consumed and integrated instead; #[cfg] on the inner field is rejected explicitly).
  • [FEATURE] Support rust_decimal::Decimal as an inner type behind the rust_decimal feature flag, with the standard numeric validators and sanitizers (see #242).
  • [FEATURE] Friendlier error when a #[nutype(...)] attribute is mistyped: suggests the closest match (e.g. validte -> validate) and lists the available nutype attributes (see #240).
  • [FIX] Fix misleading error for value-type mismatches in validators (see #241).
  • [FIX] Improve rust-analyzer resilience: when #[nutype(...)] arguments fail to parse (e.g. while still being typed), emit a best-effort type skeleton alongside the error so the newtype stays resolvable and downstream completions keep working (see #178).
  • [FIX] Correct the validation error Display message for float newtypes: less now reads "The value must be less than ..." and less_or_equal reads "The value must be less or equal to ..." (the two were previously swapped). Integer and decimal were already correct.
  • [FIX] Macro expansion is now reproducible: traits were collected into a HashSet, whose iteration order varies between expansions, so the order of derives and generated impls in the emitted code was nondeterministic. Traits are now kept in a BTreeSet and emitted in a stable order.
  • [INTERNAL] Consolidate the integer, float and decimal backends onto a shared numeric code-generation and validation layer (common/generate/numeric.rs and shared helpers in common/validate.rs), removing a large amount of duplicated code. No change to generated code or public API.
  • [IMPROVEMENT] Mark the generated new, try_new and new_unchecked constructors with #[inline] so they can be inlined across crate boundaries, matching the existing into_inner (see #237).

v0.7.0 - 2026-04-25

  • [BREAKING] Rename derive_unsafe to derive_unchecked (both the feature flag and the attribute).
  • [FEATURE] Support cfg_attr for conditional derives, e.g. cfg_attr(feature = "serde", derive(Serialize, Deserialize)). Supports complex predicates and multiple entries.
  • [FEATURE] Support where clauses in generic newtypes, including Higher-Ranked Trait Bounds (HRTB) like for<'a> &'a C: IntoIterator (see #160).
  • [FEATURE] Ability to control constructor visibility with constructor(visibility = ...) attribute (see #211).
  • [FEATURE] Add len_utf16_min and len_utf16_max validators for string types to validate UTF-16 code unit length (useful for JavaScript interop) (see #162).
  • [FEATURE] Ability to derive Valuable (requires valuable feature).

v0.6.2 - 2025-06-30

  • [FEATURE] Introduce derive_unsafe(..) attribute to derive any arbitrary trait (requires derive_unsafe feature to be enabled).
  • [FIX] Update Rust edition: 2021 -> 2024.
  • [FIX] Improve error messages for len_char_max and len_char_min validators.

v0.6.1 - 2025-02-09

  • [FIX] Fix derive(Deserialize) for no_std.

v0.6.0 - 2025-02-02

  • [FEATURE] Ability to instantiate types in const context, when declared with const_fn flag.
  • [FEATURE] Support derive(IntoIterator) for inner types that implement IntoIterator.
  • [FIX] Enable &'a str as an inner type.
  • [BREAKING] Fallible ::new() constructor is removed (was deprecated in 0.4.3).

v0.5.1 - 2024-12-20

  • [FEATURE] In no_std generate implementation of ::core::error::Error if Rust version is 1.81 or higher.
  • [FIX] Enable to specify custom error as a path (see #186, #187)
  • [FIX] Make Deserialize derive compile when combination of no_std and serde features are used (#182)
  • [FIX] Fix lint warnings about inner generated module
  • [FIX] Fix a conflict when used with borsch crate (#195)

v0.5.0 - 2024-09-02

  • [FEATURE] Added support for custom error types and validation functions via the error and with attributes.
  • [BREAKING] Replaced lazy_static with std::sync::LazyLock for regex validation. This requires Rust 1.80 or higher and may cause compilation issues on older Rust versions due to the use of std::sync::LazyLock. If upgrading Rust isn't an option, you can still use lazy_static explicitly as a workaround.
  • [BREAKING] The fallible ::new() constructor has been fully replaced by ::try_new().

... (truncated)

Commits
  • 33124f0 Merge pull request #261 from greyblake/prepare-v080
  • 1235055 Prepare v0.8.0
  • 202dc17 Prepare v0.8.0-beta.2
  • b7ef09a Merge pull request #259 from greyblake/fix-ui-tests-rust-1.98
  • 325ab60 Fix UI tests on Rust 1.98.0
  • fd55136 Merge pull request #257 from sietseringers/reproducibility
  • 2ff468e Merge pull request #258 from ChrisJr404/inline-constructors
  • d592cbb Merge pull request #256 from atezet/patch-1
  • bcf3af9 Mark generated constructors as #[inline]
  • 881fc39 Add line to changelog
  • Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Updates the requirements on [nutype](https://github.com/greyblake/nutype) to permit the latest version.
- [Release notes](https://github.com/greyblake/nutype/releases)
- [Changelog](https://github.com/greyblake/nutype/blob/master/CHANGELOG.md)
- [Commits](greyblake/nutype@v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: nutype
  dependency-version: 0.8.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file rust Pull requests that update rust code labels Sep 25, 2026
@mt-empty
mt-empty merged commit f1cc0f7 into master Sep 26, 2026
1 check passed
@mt-empty
mt-empty deleted the dependabot/cargo/nutype-0.8 branch September 26, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant