3 releases (breaking)

0.7.0 Aug 5, 2022
0.6.0 Jun 14, 2022
0.5.0 Jun 8, 2022

#131 in Email

39 downloads per month
Used in imap-codec


4.5K SLoC

Misuse-resistant IMAP Types

This library provides types, i.e., structs and enums, to support IMAP4rev1 implementations. The types were initially extracted from imap-codec -- an IMAP parser and serializer -- and may now serve as a common basis for diverse IMAP implementations in Rust.


  • Rust's type system is used to enforce correctness and make the library misuse-resistant. It must not be possible to construct a type that violates the IMAP specification.
  • Fuzzing (via cargo fuzz) and property-based tests are used to uncover bugs. The library is fuzz-tested never to produce an invalid message.

Core Types

To ensure correctness, imap-types makes use of types such as AString, Atom, IString, Quoted, and Literal (from the core module). It is good to know these types, because IMAP may require different message flows depending on what type was used to encode certain information such as a username or password. When constructing types, imap-types will automatically choose the best encoding.


This crate is dual-licensed under Apache 2.0 and MIT terms.


~26K SLoC