made_core/ports/
enqueue_outcome.rs1use crate::value_objects::HostDeliveryRecord;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
11pub enum EnqueueOutcome {
12 Enqueued(HostDeliveryRecord),
14 AlreadyQueued(HostDeliveryRecord),
16}
17
18impl EnqueueOutcome {
19 #[must_use]
20 pub const fn record(&self) -> &HostDeliveryRecord {
21 match self {
22 Self::Enqueued(record) | Self::AlreadyQueued(record) => record,
23 }
24 }
25
26 #[must_use]
27 pub const fn is_new(&self) -> bool {
28 matches!(self, Self::Enqueued(_))
29 }
30
31 #[must_use]
32 pub fn into_record(self) -> HostDeliveryRecord {
33 match self {
34 Self::Enqueued(record) | Self::AlreadyQueued(record) => record,
35 }
36 }
37}