Skip to main content

pinto/backlog/
status.rs

1//! Workflow state.
2
3use std::fmt;
4
5/// Workflow status (Kanban column name).
6#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7pub struct Status(String);
8
9impl Status {
10    /// Create a status, trimming leading and trailing whitespace.
11    pub fn new(value: impl Into<String>) -> Self {
12        Self(value.into().trim().to_string())
13    }
14
15    /// Return the status string.
16    #[must_use]
17    pub fn as_str(&self) -> &str {
18        &self.0
19    }
20}
21
22impl fmt::Display for Status {
23    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24        f.write_str(&self.0)
25    }
26}