issue.rs: add fmt::Display for State
This commit is contained in:
parent
ed1b4488b2
commit
a6d2f7d1e8
1 changed files with 16 additions and 0 deletions
16
src/issue.rs
16
src/issue.rs
|
|
@ -1,3 +1,4 @@
|
||||||
|
use core::fmt;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
|
@ -62,6 +63,21 @@ impl FromStr for State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for State {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
let fmt_str = match self {
|
||||||
|
State::New => "new",
|
||||||
|
State::Backlog => "backlog",
|
||||||
|
State::Blocked => "blocked",
|
||||||
|
State::InProgress => "inprogress",
|
||||||
|
State::Done => "done",
|
||||||
|
State::WontDo => "wontdo",
|
||||||
|
|
||||||
|
};
|
||||||
|
write!(f, "{fmt_str}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Issue {
|
impl Issue {
|
||||||
pub fn new_from_dir(dir: &std::path::Path) -> Result<Self, IssueError> {
|
pub fn new_from_dir(dir: &std::path::Path) -> Result<Self, IssueError> {
|
||||||
let mut description: Option<String> = None;
|
let mut description: Option<String> = None;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue