Skip to main content

dream_ini/
warnings.rs

1// SPDX-License-Identifier: GPL-3.0-only
2
3use std::fmt;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub enum ImportWarning {
7    IgnoredEmptyValue { key: String },
8    MalformedIniLine { line: String },
9    MissingGameFile { file: String },
10}
11
12impl fmt::Display for ImportWarning {
13    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14        match self {
15            Self::IgnoredEmptyValue { key } => write!(f, "ignored empty value for key '{key}'."),
16            Self::MalformedIniLine { line } => {
17                write!(f, "ini file wrongly formatted ({line}). Line ignored.")
18            }
19            Self::MissingGameFile { file } => {
20                write!(
21                    f,
22                    "GameFile entry not found: {file}. Later GameFile entries were not imported."
23                )
24            }
25        }
26    }
27}