Derive Copy and Clone for Page and add a Frame::clone method

This commit is contained in:
Philipp Oppermann
2017-04-13 20:04:01 +02:00
parent bb3f17c0b9
commit 1f1f6c62da
2 changed files with 5 additions and 0 deletions

View File

@@ -19,6 +19,10 @@ impl Frame {
fn start_address(&self) -> PhysicalAddress { fn start_address(&self) -> PhysicalAddress {
self.number * PAGE_SIZE self.number * PAGE_SIZE
} }
fn clone(&self) -> Frame {
Frame { number: self.number }
}
} }
pub trait FrameAllocator { pub trait FrameAllocator {

View File

@@ -11,6 +11,7 @@ const ENTRY_COUNT: usize = 512;
pub type PhysicalAddress = usize; pub type PhysicalAddress = usize;
pub type VirtualAddress = usize; pub type VirtualAddress = usize;
#[derive(Debug, Clone, Copy)]
pub struct Page { pub struct Page {
number: usize, number: usize,
} }