use crate::{AuthorisedEntry, Entry};
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct LengthyEntry<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD> {
entry: Entry<MCL, MCC, MPL, N, S, PD>,
available: u64,
}
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD>
LengthyEntry<MCL, MCC, MPL, N, S, PD>
{
pub fn new(entry: Entry<MCL, MCC, MPL, N, S, PD>, available: u64) -> Self {
Self { entry, available }
}
pub fn entry(&self) -> &Entry<MCL, MCC, MPL, N, S, PD> {
&self.entry
}
pub fn available(&self) -> u64 {
self.available
}
pub fn into_entry(self) -> Entry<MCL, MCC, MPL, N, S, PD> {
self.entry
}
}
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD>
AsRef<Entry<MCL, MCC, MPL, N, S, PD>> for LengthyEntry<MCL, MCC, MPL, N, S, PD>
{
fn as_ref(&self) -> &Entry<MCL, MCC, MPL, N, S, PD> {
&self.entry
}
}
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct LengthyAuthorisedEntry<
const MCL: usize,
const MCC: usize,
const MPL: usize,
N,
S,
PD,
AT,
> {
entry: AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>,
available: u64,
}
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT>
LengthyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
{
pub fn new(entry: AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>, available: u64) -> Self {
Self { entry, available }
}
pub fn entry(&self) -> &AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT> {
&self.entry
}
pub fn available(&self) -> u64 {
self.available
}
pub fn into_authorised_entry(self) -> AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT> {
self.entry
}
}
impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT>
AsRef<AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>>
for LengthyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
{
fn as_ref(&self) -> &AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT> {
&self.entry
}
}