use core::marker::PhantomData;
use crate::{PTEArch, PTEGeneric};
#[repr(transparent)]
#[derive(Clone, Copy)]
pub struct Pte<P: PTEArch> {
v: usize,
_phantom: PhantomData<P>,
}
impl<P: PTEArch> Pte<P> {
pub fn new(config: PTEGeneric) -> Self {
Pte {
v: P::new_pte(config),
_phantom: PhantomData,
}
}
pub fn read(&self) -> PTEGeneric {
P::read_pte(self.v)
}
pub fn as_usize(&self) -> usize {
self.v
}
}