completed 06 ticket management
Some checks failed
CI / build (push) Failing after 1m16s
CI / gravity (push) Has been skipped
CI / is_fresh (push) Successful in 26s
CI / formatter (push) Failing after 17s

This commit is contained in:
2025-04-07 12:12:47 +05:30
parent 199b57aad8
commit 9bc063a05b
5 changed files with 65 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ pub struct TicketStore {
counter: u64,
}
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct TicketId(u64);
#[derive(Clone, Debug, PartialEq)]
@@ -38,7 +38,7 @@ pub enum Status {
impl TicketStore {
pub fn new() -> Self {
Self {
tickets: todo!(),
tickets: HashMap::new(),
counter: 0,
}
}
@@ -52,16 +52,16 @@ impl TicketStore {
description: ticket.description,
status: Status::ToDo,
};
todo!();
self.tickets.insert(id, ticket);
id
}
pub fn get(&self, id: TicketId) -> Option<&Ticket> {
todo!()
self.tickets.get(&id)
}
pub fn get_mut(&mut self, id: TicketId) -> Option<&mut Ticket> {
todo!()
self.tickets.get_mut(&id)
}
}