Skip to main content

imap_core/
lib.rs

1//! Protocol core for the [`imap-rs`](https://crates.io/crates/imap-rs) library.
2//!
3//! `imap-rs-core` owns the IMAP4rev2 (RFC 9051) response model and a zero-copy,
4//! hand-rolled recursive-descent parser. It performs **no I/O** and has no
5//! network dependencies, which keeps it small and trivially testable.
6//!
7//! # Layout
8//!
9//! - [`ast`] — the typed response grammar ([`Response`], [`Status`], data
10//!   responses, and `FETCH` attributes).
11//! - [`parser`] — [`parse_response`], which turns a byte slice into a
12//!   [`Response`], borrowing from the input where possible.
13//! - [`error`] — [`ParseError`], the failure type returned by the parser.
14//!
15//! # Example
16//!
17//! ```
18//! use imap_core::parser::parse_response;
19//!
20//! let input = b"* OK IMAP4rev2 Service Ready\r\n";
21//! let (_rest, response) = parse_response(input).expect("valid greeting");
22//! ```
23#![forbid(unsafe_code)]
24
25/// Typed IMAP4rev2 response grammar: [`Response`] and its constituents.
26pub mod ast;
27/// Parser failure type: [`ParseError`].
28pub mod error;
29/// Zero-copy response parser: [`parse_response`].
30pub mod parser;
31
32pub use ast::*;
33pub use error::ParseError;
34pub use parser::parse_response;