Skip to content
CAI
Software that uses CAICheck a score

serde-rs/serde

71.5

Strong · 29 September 2026

23.7k

lines of production code

Rust

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is the Serde library for Rust, providing serialization and deserialization capabilities through core traits and procedural macros. It is architecturally split into a lightweight \serde\_core\ crate for trait definitions and a separate \serde\_derive\ crate for code generation, allowing for optimized build times and parallel compilation. The system supports a wide range of data structures and serialization formats, including complex enum tagging strategies and borrowed data, while enforcing strict compile-time validation via comprehensive UI tests.

How it got here

2014–2017 — core extraction and modernization

11 changes.

This period focused on restructuring the codebase by extracting core serialization logic into a separate serde\_core crate, while updating dependencies to Rust 2021 and syn 3. The work also involved refining build isolation, consolidating derive internals, and significantly expanding the test suite to cover no\_std environments and complex serialization scenarios.

2018 — derive macro validation and testing

13 changes.

This period focused on restructuring the internal logic of serde\_derive to improve maintainability and error reporting. A significant effort was dedicated to expanding the test suite with comprehensive UI tests to validate attribute parsing, detect conflicts, and ensure clear compile-time error messages for invalid configurations.

2023–2025 — serde\_core extraction and test expansion

10 changes.

The project extracted core serialization and deserialization traits into a new serde\_core crate to enable parallel compilation and reduce build times for downstream consumers. Concurrently, the test suite was expanded with comprehensive regression and UI tests covering serde derive edge cases, attribute validation, and diagnostic accuracy.

Features

Add no\_std test suite for serde serialization

A new no\_std test environment has been added to verify that serde's Serialize and Deserialize implementations function correctly without the standard library. This test suite includes basic data structures (unit, newtype, tuple, struct, and enum types) and configures a custom panic handler and main entry point to ensure compatibility with embedded or bare-metal targets.

_test\_suite/no\std · high confidence

Introduce serde\_core crate for no-derive serialization traits

A new \serde\_core\ crate has been added that contains Serde's core serialization and deserialization traits (\Serialize\, \Deserialize\, etc.) but explicitly excludes the \\#\[derive\]\ macro support. This allows libraries to depend on the lightweight trait definitions without pulling in the heavier \serde\_derive\ compilation step, which can improve build times for downstream consumers. The crate enforces this separation by emitting a compile error if \\#\[derive\]\ is used while only \serde\_core\ is present, ensuring that derive functionality remains tied to the main \serde\ crate.

_serde\core/src · high confidence

Introduction of serde\_core crate for parallel compilation

A new \serde\_core\ crate has been extracted from the main \serde\ library, containing only the core trait definitions without the \\#\[derive()\]\ macro support. This separation allows crates that handwrite Serde implementations or use traits as bounds to depend on \serde\_core\ instead of \serde\, enabling them to compile in parallel with \serde\_derive\ even when the \serde\ crate's derive feature is enabled, thereby reducing build times. The \serde\_core\ crate includes a build script that configures various \rustc\ configuration flags based on the compiler version to ensure compatibility with older Rust releases.

_serde\core · high confidence

Architecture

Extract serde\_core deserialization framework

The deserialization logic has been extracted into the new \serde\_core\ crate, introducing dedicated modules for the generic deserialization framework (\mod.rs\), primitive type implementations (\impls.rs\), value-based deserialization (\value.rs\), and the \IgnoredAny\ utility for discarding data. This change establishes the core deserialization traits and implementations as a separate, foundational component.

_serde\core/src/de · high confidence

Internal derive logic restructured into a dedicated \`internals\` module

The internal implementation of \serde\_derive\ has been reorganized by moving the core parsing, attribute handling, and validation logic into a new \serde\_derive/src/internals\ module. This change introduces dedicated modules for the internal AST (\ast.rs\), attribute parsing (\attr.rs\), case renaming rules (\case.rs\), and cross-cutting validation checks (\check.rs\). For users, this is a structural refactor that consolidates how \\#\[serde(...)\]\ attributes are parsed and validated, improving the maintainability and clarity of the derive macro's internal error reporting and logic without altering the public API.

_serde\derive/src/internals · high confidence

Serde core logic extracted into a separate serde\_core crate

The core serialization and deserialization logic has been moved from the main \serde\ crate into a new \serde\_core\ crate. The \serde\ crate now acts as a thin wrapper that re-exports \serde\_core\ types, with special handling to inline \serde\_core\ documentation during docs.rs builds to avoid cross-crate rustdoc issues. This architectural change separates the foundational traits and types from the derive macros and other features, potentially improving build times and reducing dependencies for users who do not need the derive functionality.

serde/src · high confidence

Serialization framework extracted to serde\_core

The core serialization logic, including the \Serialize\ and \Serializer\ traits, standard type implementations, and the \Impossible\ helper type, has been moved into the new \serde\_core\ crate. This change establishes the foundational serialization framework in a separate module, preparing the codebase for further separation of concerns.

_serde\core/src/ser · high confidence

Behavioural changes

Initial project scaffolding and legacy code removal

This change establishes the repository's foundational structure by adding essential documentation and configuration files, including a detailed CONTRIBUTING guide, Apache-2.0 and MIT license texts, and a README with usage examples and support links. It also introduces a .gitignore to manage build artifacts and lockfiles. Concurrently, it removes the legacy \de.rs\ file, which contained outdated deserialization logic using obsolete Rust syntax (such as \deriving\ and \StrBuf\), clearing the way for the modern implementation.

(repo-wide) · high confidence

Introduction of serde\_core private implementation modules

The \serde\_core\ crate now includes a \private\ module containing internal implementation details such as the \Content\ enum for buffering deserializer contents, \InPlaceSeed\ for in-place deserialization, and helper utilities for string conversion (\from\_utf8\_lossy\) and size hints. These components, marked with \\#\[doc(hidden)\]\ and \do\_not\_recommend\ attributes, are intended for use by generated code and internal machinery rather than direct user consumption, effectively separating core serialization logic from the public API surface.

_serde\core/src/private · high confidence

Refactored deserialization code generation into modular sub-modules

The deserialization logic in \serde\derive\ has been reorganized to improve maintainability and reduce compiler resource usage. The monolithic body generators have been split into dedicated modules for each data structure and enum tagging strategy: \enum\\ (coordinator), \enum\_adjacently\, \enum\_externally\, \enum\_internally\, \enum\untagged\, \identifier\, \struct\\, \tuple\, and \unit\. This refactoring also includes renaming internal functions to use the \deserialize\_\ prefix (e.g., \generate\_body\ to \deserialize\) and optimizing the generated code by avoiding the \?\ operator where possible to reduce LLVM lines.

_serde\derive/src/de · high confidence

Refactored private deserialization and serialization internals

The private implementation details in \serde/src/private\ have been reorganized to improve code clarity and maintainability. The \de.rs\ and \ser.rs\ modules now contain the core logic for deserializing and serializing data, including support for handling missing fields, borrowing \Cow\ strings and bytes, and managing tagged newtype variants. The \mod.rs\ file centralizes the public exports from these private modules and re-exports necessary standard library types, ensuring that the internal machinery remains encapsulated while providing the necessary hooks for the derive macros.

serde/src/private · high confidence

Serde derive macros now enforce that the \`serde\` crate, not \`serde\_core\`, is used

The \serde\_derive\ crate now generates code that explicitly requires the \serde\ crate rather than \serde\_core\. This is implemented by wrapping the generated implementation in a constant that invokes \\serde::\\_require\_serde\_not\_serde\_core!()\, ensuring that users cannot accidentally derive serialization or deserialization for types when only the core library is available. This change prevents subtle runtime errors or missing functionality that would occur if the derive macros were used with \serde\_core\.

_serde\derive/src · high confidence

Serde now uses a private module per patch version to isolate build-time configuration

The serde crate's build script now generates a unique private module (e.g., \\_\_private123\) for each patch version, writing it to the build output directory. This change ensures that internal build-time configuration flags and private API usage are strictly scoped to the specific patch version being built, preventing potential conflicts or stale state when multiple patch versions of serde are present in a build environment. Users benefit from more robust and isolated builds, particularly in complex dependency trees.

serde · high confidence

Update crate metadata and build script for serde\_derive

The serde\_derive crate now includes a build script that enables Rust's check-cfg feature to resolve unexpected\_cfgs warnings, and replaces local license and readme files with symlinks to the parent directory to ensure they are included in the crates.io archive.

_serde\derive · high confidence

serde\_derive\_internals restructured to delegate to serde\_derive

The serde\_derive\_internals crate has been restructured to no longer contain its own implementation files. Instead, it now acts as a thin wrapper that re-exports the internals module from the serde\_derive crate via a symlink (src -\> ../serde\_derive/src/internals/). A new build script handles Windows git checkout issues where symlinks might not be correctly wired, ensuring the build falls back to relative paths when necessary. This change consolidates the derive internals code into the serde\_derive crate while maintaining the serde\_derive\_internals crate as a compatibility layer.

_serde\_derive\internals · high confidence

Test coverage

Added UI test for incorrect \with\ attribute types; Added UI tests for \\#\[serde(borrow)\]\ error handling; Added UI tests for \from\, \into\, and \try\_from\ type attribute parsing errors; Added UI tests for deprecated serialization helper functions; Added UI tests for enum representation validation errors; Added UI tests for internally tagged tuple and unit structs; Added UI tests for invalid rename attributes and unsupported union derives; Added UI tests for malformed serde attributes; Added UI tests for remote derive error handling; Added UI tests for serde attribute conflicts; Added UI tests for serde(transparent) validation rules; Added UI tests for unimplemented trait diagnostics; Added UI tests for unknown rename rules; Added macro helpers for collection construction and token iteration in the test suite; Added regression tests for serde derive edge cases; Added test for raw identifier support in enum variants; Expanded UI test coverage for Serde derive error diagnostics; Expanded test suite for serialization and deserialization.

Dependencies

Serde 1.0.229 release with syn 3 and Rust 2021 edition

This update releases Serde 1.0.229 across the \serde\, \serde\_core\, and \serde\_derive\ crates, alongside \serde\_derive\_internals\ 0.30.0. The project has migrated to the Rust 2021 edition and updated its internal dependencies to \syn\ 3, \proc-macro2\ 1.0.74, and \quote\ 1.0.35. The minimum supported Rust version (MSRV) is now 1.56 for the core crates and 1.71 for the derive crate. The workspace structure uses Cargo resolver 2, and the test suite has been updated to use \trybuild\ 1.0.116 and \automod\ 1.0.1.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 72 → 72 (+0.0)
  • Rubric changed (rubric-2026.09.8 → rubric-2026.09.17) — scores are not directly comparable.

Lenses

  • Code Health 86 → 86 (+0.0)
  • Architecture 100 → 100 (+0.0)
  • Maturity 62 → 62 (+0.2)
  • Readiness 64 → 67 (+2.3)
  • Security 100 → 100 (+0.0)

Resolved (3)

  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Off-boarding risk: anonymized user #1

New (3)

  • Dependency hygiene PARTLY measured — Cargo dependencies read, no committed lock to grade for currency
  • Inverted test pyramid
  • Off-boarding risk: anonymized user #1

Changes since last survey

  • 1 commits — 1 feature/other, 0 fixes

By area

  • test_suite/tests — 1 commit

Notable commits

  • change: Update ui test suite to nightly-2026-09-22

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

serde-rs/serde was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 29 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 6693a89cca77e0151437da1c7f890090b9ebf04c — the exact code this score is about.
  • Scored under rubric-2026.09.17 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-fbec9b1e08c2.