imessage_database/error/
streamtyped.rs

1/*!
2 Errors that can happen when parsing `typedstream` data. This module is for the legacy simple `typedstream` parser.
3*/
4
5use std::fmt::{Display, Formatter, Result};
6
7/// Errors that can happen when parsing `typedstream` data
8#[derive(Debug)]
9pub enum StreamTypedError {
10    NoStartPattern,
11    NoEndPattern,
12    InvalidPrefix,
13    InvalidTimestamp,
14}
15
16impl Display for StreamTypedError {
17    fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
18        match self {
19            StreamTypedError::NoStartPattern => write!(fmt, "No start pattern found!"),
20            StreamTypedError::NoEndPattern => write!(fmt, "No end pattern found!"),
21            StreamTypedError::InvalidPrefix => write!(fmt, "Prefix length is not standard!"),
22            StreamTypedError::InvalidTimestamp => write!(fmt, "Timestamp integer is not valid!"),
23        }
24    }
25}