wc_parser/
models.rs

1use chrono::{DateTime, Utc};
2
3#[derive(Debug, PartialEq)]
4pub struct RawMessage {
5    pub system: bool,
6    pub msg: String,
7}
8
9#[derive(Debug, PartialEq)]
10pub struct Attachment {
11    /// The filename of the attachment, including the extension.
12    pub file_name: String,
13}
14
15#[derive(Debug, PartialEq)]
16pub struct Message {
17    /// The date of the message.
18    pub date: DateTime<Utc>,
19    /// The author of the message. Will be None for messages without an author (system messages).
20    pub author: Option<String>,
21    /// The message itself.
22    pub message: String,
23    /// Available for messages containing attachments when setting the option
24    /// `parse_attachments` to `true`.
25    pub attachment: Option<Attachment>,
26}
27
28#[derive(Debug, Default)]
29pub struct ParseStringOptions {
30    /// Specify if the dates in your log file start with a day (`true`) or a month
31    /// (`false`).
32    ///
33    /// Manually specifying this may improve performance.
34    pub days_first: Option<bool>,
35    /// Specify if attachments should be parsed.
36    ///
37    /// If set to `true`, messages containing attachments will include an
38    /// `attachment` property.
39    pub parse_attachments: bool,
40    /// Enable debug output during parsing.
41    ///
42    /// If set to `true`, detailed information about the parsing process will be
43    /// printed to stdout, including regex matches, message processing steps, and
44    /// statistics.
45    pub debug: bool,
46}