Skip to main content

wdl_core/concern/code/
kind.rs

1//! Kinds of concern codes.
2
3use serde::Deserialize;
4use serde::Serialize;
5
6/// A kind of concern code.
7#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
8pub enum Kind {
9    /// An error concern code.
10    Error,
11
12    /// A warning concern code.
13    Warning,
14}
15
16impl Kind {
17    /// Gets the prefix for this [`Kind`].
18    ///
19    /// # Examples
20    ///
21    /// ```
22    /// use wdl_core::concern::code::Kind;
23    ///
24    /// assert_eq!(Kind::Error.prefix(), 'E');
25    /// assert_eq!(Kind::Warning.prefix(), 'W');
26    /// ```
27    pub fn prefix(&self) -> char {
28        match self {
29            Kind::Error => 'E',
30            Kind::Warning => 'W',
31        }
32    }
33}