1use crate::{AuthorisedEntry, Entry};
2
3#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub struct LengthyEntry<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD> {
8 entry: Entry<MCL, MCC, MPL, N, S, PD>,
10 available: u64,
12}
13
14impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD>
15 LengthyEntry<MCL, MCC, MPL, N, S, PD>
16{
17 pub fn new(entry: Entry<MCL, MCC, MPL, N, S, PD>, available: u64) -> Self {
19 Self { entry, available }
20 }
21
22 pub fn entry(&self) -> &Entry<MCL, MCC, MPL, N, S, PD> {
24 &self.entry
25 }
26
27 pub fn available(&self) -> u64 {
29 self.available
30 }
31
32 pub fn into_entry(self) -> Entry<MCL, MCC, MPL, N, S, PD> {
34 self.entry
35 }
36}
37
38impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD>
39 AsRef<Entry<MCL, MCC, MPL, N, S, PD>> for LengthyEntry<MCL, MCC, MPL, N, S, PD>
40{
41 fn as_ref(&self) -> &Entry<MCL, MCC, MPL, N, S, PD> {
42 &self.entry
43 }
44}
45
46#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
48pub struct LengthyAuthorisedEntry<
49 const MCL: usize,
50 const MCC: usize,
51 const MPL: usize,
52 N,
53 S,
54 PD,
55 AT,
56> {
57 entry: AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>,
59 available: u64,
61}
62
63impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT>
64 LengthyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
65{
66 pub fn new(entry: AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>, available: u64) -> Self {
68 Self { entry, available }
69 }
70
71 pub fn entry(&self) -> &AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT> {
73 &self.entry
74 }
75
76 pub fn available(&self) -> u64 {
78 self.available
79 }
80
81 pub fn into_authorised_entry(self) -> AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT> {
83 self.entry
84 }
85}
86
87impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT>
88 AsRef<AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>>
89 for LengthyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
90{
91 fn as_ref(&self) -> &AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT> {
92 &self.entry
93 }
94}