Add a remap_the_kernel function

This commit is contained in:
Philipp Oppermann
2017-04-18 12:11:40 +02:00
parent 60d7c736a5
commit e029eabe18
2 changed files with 67 additions and 0 deletions

View File

@@ -23,8 +23,34 @@ impl Frame {
fn clone(&self) -> Frame {
Frame { number: self.number }
}
fn range_inclusive(start: Frame, end: Frame) -> FrameIter {
FrameIter {
start: start,
end: end,
}
}
}
struct FrameIter {
start: Frame,
end: Frame,
}
impl Iterator for FrameIter {
type Item = Frame;
fn next(&mut self) -> Option<Frame> {
if self.start <= self.end {
let frame = self.start.clone();
self.start.number += 1;
Some(frame)
} else {
None
}
}
}
pub trait FrameAllocator {
fn allocate_frame(&mut self) -> Option<Frame>;
fn deallocate_frame(&mut self, frame: Frame);