Skip to main content

made_core/ports/
host_delivery_page.rs

1use crate::value_objects::{HostDeliveryId, HostDeliveryRecord};
2
3/// One page of the ledger, in identifier order.
4#[derive(Debug, Clone, Default, PartialEq, Eq)]
5pub struct HostDeliveryPage {
6    records: Vec<HostDeliveryRecord>,
7    next_cursor: Option<HostDeliveryId>,
8}
9
10impl HostDeliveryPage {
11    #[must_use]
12    pub const fn new(
13        records: Vec<HostDeliveryRecord>,
14        next_cursor: Option<HostDeliveryId>,
15    ) -> Self {
16        Self {
17            records,
18            next_cursor,
19        }
20    }
21
22    #[must_use]
23    pub fn records(&self) -> &[HostDeliveryRecord] {
24        &self.records
25    }
26
27    #[must_use]
28    pub fn into_records(self) -> Vec<HostDeliveryRecord> {
29        self.records
30    }
31
32    /// Where to continue, when there is more.
33    #[must_use]
34    pub const fn next_cursor(&self) -> Option<&HostDeliveryId> {
35        self.next_cursor.as_ref()
36    }
37}