aboutsummaryrefslogtreecommitdiff
path: root/ctru-rs/src/sdmc.rs
blob: de08a9aa2b1e58360b401fdf2353dac5b02bb8e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
pub struct Sdmc(());

impl Sdmc {
    pub fn init() -> ::Result<Sdmc> {
        unsafe {
            let r = ::libctru::archiveMountSdmc();
            if r < 0 {
                Err(r.into())
            } else {
                Ok(Sdmc(()))
            }
        }
    }
}

impl Drop for Sdmc {
    fn drop(&mut self) {
        unsafe { ::libctru::archiveUnmountAll() };
    }
}