Skip to main content

Crate ember_protocol

Crate ember_protocol 

Source
Expand description

ember-protocol: RESP3 wire protocol implementation.

Provides zero-copy parsing and direct-to-buffer serialization of the RESP3 protocol used for client-server communication.

§quick start

use bytes::{Bytes, BytesMut};
use ember_protocol::{Frame, parse_frame};

// parse a simple string
let input = b"+OK\r\n";
let (frame, consumed) = parse_frame(input).unwrap().unwrap();
assert_eq!(frame, Frame::Simple("OK".into()));

// serialize a frame
let mut buf = BytesMut::new();
frame.serialize(&mut buf);
assert_eq!(&buf[..], b"+OK\r\n");

Re-exports§

pub use command::Command;
pub use command::SetExpire;
pub use command::ZAddFlags;
pub use error::ProtocolError;
pub use parse::parse_frame;
pub use parse::parse_frame_bytes;
pub use types::wire;
pub use types::Frame;

Modules§

command
Command parsing from RESP3 frames.
error
Protocol error types for RESP3 parsing.
parse
Zero-copy RESP3 parser.
types
RESP3 frame types.