refactor: state-kind conversion
This commit is contained in:
parent
320575e9c3
commit
3652f0d39f
17
src/task.rs
17
src/task.rs
|
@ -85,7 +85,7 @@ impl Task {
|
||||||
) -> Option<Event> {
|
) -> Option<Event> {
|
||||||
sender
|
sender
|
||||||
.submit(EventBuilder::new(
|
.submit(EventBuilder::new(
|
||||||
state.kind(),
|
state.into(),
|
||||||
comment,
|
comment,
|
||||||
vec![Tag::event(self.event.id)],
|
vec![Tag::event(self.event.id)],
|
||||||
))
|
))
|
||||||
|
@ -234,15 +234,20 @@ impl State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn kind(&self) -> Kind {
|
pub(crate) fn kind(&self) -> u64 {
|
||||||
match self {
|
match self {
|
||||||
State::Open => Kind::from(1630),
|
State::Open => 1630,
|
||||||
State::Done => Kind::from(1631),
|
State::Done => 1631,
|
||||||
State::Closed => Kind::from(1632),
|
State::Closed => 1632,
|
||||||
State::Active => Kind::from(1633),
|
State::Active => 1633,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl From<State> for Kind {
|
||||||
|
fn from(value: State) -> Self {
|
||||||
|
Kind::from(value.kind())
|
||||||
|
}
|
||||||
|
}
|
||||||
impl Display for State {
|
impl Display for State {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
fmt::Debug::fmt(self, f)
|
fmt::Debug::fmt(self, f)
|
||||||
|
|
Loading…
Reference in New Issue