ember_protocol/lib.rs
1//! ember-protocol: RESP3 wire protocol implementation.
2//!
3//! Provides zero-copy parsing and direct-to-buffer serialization
4//! of the RESP3 protocol used for client-server communication.
5//!
6//! # quick start
7//!
8//! ```
9//! use bytes::{Bytes, BytesMut};
10//! use ember_protocol::{Frame, parse_frame};
11//!
12//! // parse a simple string
13//! let input = b"+OK\r\n";
14//! let (frame, consumed) = parse_frame(input).unwrap().unwrap();
15//! assert_eq!(frame, Frame::Simple("OK".into()));
16//!
17//! // serialize a frame
18//! let mut buf = BytesMut::new();
19//! frame.serialize(&mut buf);
20//! assert_eq!(&buf[..], b"+OK\r\n");
21//! ```
22
23pub mod command;
24pub mod error;
25pub mod parse;
26mod serialize;
27pub mod types;
28
29pub use command::{Command, SetExpire};
30pub use error::ProtocolError;
31pub use parse::parse_frame;
32pub use types::Frame;