Skip to content

Make imap-types no_std compatible - #732

Merged
duesee merged 1 commit into
duesee:mainfrom
soywod:imap-types-no-std
Oct 1, 2026
Merged

duesee merged 1 commit into
duesee:mainfrom
soywod:imap-types-no-std

Conversation

@soywod

@soywod soywod commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

With this PR, imap-types is now #![no_std] (requires alloc). This is non-breaking: features, defaults and the public API are unchanged. imap-codec is left for a follow-up PR (motivation: pimalaya/io-imap#4).

Changes

  • std:: paths became core::/alloc::, and items that came from the prelude are now imported explicitly.
  • extern crate std is gated on what brings std:
    • arbitrary: the derive expands to ::std::thread_local!.
    • tag_generator: uses rand::rng().
    • test: some tests use println!.
  • thiserror and serde use default-features = false. thiserror then implements core::error::Error, which is the same trait as std::error::Error on
    MSRV 1.85.
  • SequenceSet::normalize uses a BTreeSet instead of a HashSet. The set is always drained before the final loop, so output is unchanged.

Why no std feature

A default std feature that gates TagGenerator::generate would break users who combine default-features = false with tag_generator, as imap-codec
does. Keeping tag_generator std-only gives no_std to everyone else for free.

Verification

  • Builds for thumbv7em-none-eabihf with every feature except arbitrary and tag_generator.
  • clippy and tests are clean across all feature combinations.
  • imap-codec tests pass.

Follow-ups

  • imap-codec: EncodeContext implements std::io::Write without doing real I/O.
  • A no_std CI build job.

Refs: #495

@coveralls

coveralls commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 36941102953

Coverage remained the same at 91.697%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 10 uncovered changes across 7 files (25 of 35 lines covered, 71.43%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
imap-types/src/extensions/binary.rs 2 0 0.0%
imap-types/src/extensions/condstore_qresync.rs 2 0 0.0%
imap-types/src/response.rs 3 1 33.33%
imap-types/src/core.rs 10 9 90.0%
imap-types/src/extensions/sort.rs 1 0 0.0%
imap-types/src/extensions/thread.rs 3 2 66.67%
imap-types/src/extensions/utf8.rs 2 1 50.0%
Total (17 files) 35 25 71.43%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 11899
Covered Lines: 10911
Line Coverage: 91.7%
Coverage Strength: 726.78 hits per line

💛 - Coveralls

@duesee duesee left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you very much!

@duesee
duesee force-pushed the imap-types-no-std branch from 1cfc2c2 to cee901b Compare October 1, 2026 23:29
@duesee
duesee enabled auto-merge (rebase) October 1, 2026 23:29
@duesee
duesee merged commit bab65dc into duesee:main Oct 1, 2026
10 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.

3 participants