Browse Source
This won't be useful until we have libstd, but worth making since it's trivial.pull/10/head
Ronald Kinard
9 years ago
2 changed files with 31 additions and 0 deletions
@ -0,0 +1,28 @@ |
|||||||
|
use core::marker::PhantomData; |
||||||
|
|
||||||
|
use ::raw::sdmc::*; |
||||||
|
|
||||||
|
pub struct Sdmc { |
||||||
|
pd: PhantomData<i32> |
||||||
|
} |
||||||
|
|
||||||
|
impl Sdmc { |
||||||
|
pub fn new() -> Result<Self, i32> { |
||||||
|
unsafe { |
||||||
|
let r = sdmcInit(); |
||||||
|
if r < 0 { |
||||||
|
Err(r) |
||||||
|
} else { |
||||||
|
Ok(Sdmc { pd: PhantomData }) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
impl Drop for Sdmc { |
||||||
|
fn drop(&mut self) { |
||||||
|
unsafe { |
||||||
|
sdmcExit() |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue