stomp_parser/
lib.rs

1//! `stomp_parser` implements a model for STOMP Frames, as specified in the [STOMP Protocol Specification,Version 1.2](https://stomp.github.io/stomp-specification-1.2.html).
2//! These frames can be parsed from and serialized to byte arrays.
3//!
4//! The types primarily of interest to users of the library are the enums `client::ClientFrame` and `server::ServerFrame`, which model the frames that can be sent
5//! by STOMP clients and STOMP servers respectively. Obtaining a frame from a message is achieved via `try_from` on those types.   
6//!
7//! # Example
8//! ```
9//! use std::convert::TryFrom;
10//!
11//! use stomp_parser::client::ClientFrame;
12//! use stomp_parser::headers::HeaderValue;
13//!
14//! let message = b"SEND\n\
15//!                 destination:stairway/to/heaven\n\
16//!                 \n\
17//!                 Lorem ipsum dolor sit amet,...\x00"
18//!                 .to_vec();
19//!
20//! if let Ok(ClientFrame::Send(frame)) = ClientFrame::try_from(message) {
21//!     assert_eq!("stairway/to/heaven", frame.destination().value());
22//!     assert_eq!(b"Lorem ipsum dolor sit amet,...", frame.body().unwrap());
23//! } else {
24//!     panic!("Send Frame not parsed correctly");
25//! }
26//! ```
27#![warn(clippy::all)]
28#[macro_use]
29mod common;
30pub mod error;
31mod model;
32mod parser;
33
34pub use model::client;
35pub use model::headers;
36pub use model::server;