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

@@ -1,5 +1,7 @@
// TODO: Implement `Index<&TicketId>` and `Index<TicketId>` for `TicketStore`.
use std::ops::Index;
use ticket_fields::{TicketDescription, TicketTitle};
#[derive(Clone)]
@@ -58,6 +60,20 @@ impl TicketStore {
}
}
impl Index<TicketId> for TicketStore {
type Output = Ticket;
fn index(&self, index: TicketId) -> &Self::Output {
return &self.tickets[index.0 as usize];
}
}
impl Index<&TicketId> for TicketStore {
type Output = Ticket;
fn index(&self, index: &TicketId) -> &Self::Output {
return &self.tickets[index.0 as usize];
}
}
#[cfg(test)]
mod tests {
use crate::{Status, TicketDraft, TicketStore};