Skip to main content

imsg_formats/bmessage/
mod.rs

1//! bMessage encoder and parser (MAP spec appendix B).
2//!
3//! Parse with [`BMessage::parse`]; encode with [`BMessage::encode`].
4
5mod encode;
6mod parser;
7mod types;
8
9pub use types::{BBody, BEnvelope, BMessage, BMessageError, BVCard, MessageStatus, MessageType};
10
11impl BMessage {
12    /// Parses a bMessage from UTF-8 text, accepting CRLF and LF line endings.
13    ///
14    /// # Errors
15    ///
16    /// Returns [`BMessageError`] when a required field is absent, a section is
17    /// unterminated, or STATUS/TYPE hold unrecognised values.
18    pub fn parse(input: &str) -> Result<Self, BMessageError> {
19        parser::parse_bmessage(input)
20    }
21}