Format using rustfmt-nightly

This commit is contained in:
Philipp Oppermann
2017-06-20 17:55:33 +02:00
parent ff8e8e0f8b
commit 559a90ad8b
10 changed files with 168 additions and 111 deletions

View File

@@ -18,7 +18,8 @@ pub struct TemporaryPage {
impl TemporaryPage {
pub fn new<A>(page: Page, allocator: &mut A) -> TemporaryPage
where A: FrameAllocator
where
A: FrameAllocator,
{
TemporaryPage {
page: page,
@@ -31,18 +32,21 @@ impl TemporaryPage {
pub fn map(&mut self, frame: Frame, active_table: &mut ActivePageTable) -> VirtualAddress {
use super::entry::WRITABLE;
assert!(active_table.translate_page(self.page).is_none(),
"temporary page is already mapped");
assert!(
active_table.translate_page(self.page).is_none(),
"temporary page is already mapped"
);
active_table.map_to(self.page, frame, WRITABLE, &mut self.allocator);
self.page.start_address()
}
/// Maps the temporary page to the given page table frame in the active table.
/// Returns a reference to the now mapped table.
pub fn map_table_frame(&mut self,
frame: Frame,
active_table: &mut ActivePageTable)
-> &mut Table<Level1> {
pub fn map_table_frame(
&mut self,
frame: Frame,
active_table: &mut ActivePageTable,
) -> &mut Table<Level1> {
unsafe { &mut *(self.map(frame, active_table) as *mut Table<Level1>) }
}
@@ -56,7 +60,8 @@ struct TinyAllocator([Option<Frame>; 3]);
impl TinyAllocator {
fn new<A>(allocator: &mut A) -> TinyAllocator
where A: FrameAllocator
where
A: FrameAllocator,
{
let mut f = || allocator.allocate_frame();
let frames = [f(), f(), f()];