9 releases (5 breaking)

0.7.0 Nov 22, 2024
0.6.0 Jun 25, 2023
0.5.0 Jul 10, 2021
0.4.1 Jun 25, 2021
0.2.0 May 22, 2021

#1796 in Parser implementations

Download history 2/week @ 2024-09-23 26/week @ 2024-09-30 2/week @ 2024-10-07 121/week @ 2024-11-18 27/week @ 2024-11-25 19/week @ 2024-12-02 12/week @ 2024-12-09

179 downloads per month
Used in 2 crates

MIT license

96KB
2.5K SLoC

Crates.io CI codecov

A Rust crate for parsing Stomp frames, implemented using nom.


lib.rs:

stomp_parser implements a model for STOMP Frames, as specified in the STOMP Protocol Specification,Version 1.2. These frames can be parsed from and serialized to byte arrays.

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 by STOMP clients and STOMP servers respectively. Obtaining a frame from a message is achieved via try_from on those types.

Example

use std::convert::TryFrom;

use stomp_parser::client::ClientFrame;
use stomp_parser::headers::HeaderValue;

let message = b"SEND\n\
                destination:stairway/to/heaven\n\
                \n\
                Lorem ipsum dolor sit amet,...\x00"
                .to_vec();

if let Ok(ClientFrame::Send(frame)) = ClientFrame::try_from(message) {
    assert_eq!("stairway/to/heaven", frame.destination().value());
    assert_eq!(b"Lorem ipsum dolor sit amet,...", frame.body().unwrap());
} else {
    panic!("Send Frame not parsed correctly");
}

Dependencies

~1MB
~19K SLoC