From a97d04d63a5b358fb0ea3d7d6dcc196fb655444b Mon Sep 17 00:00:00 2001
From: Fenrir <fenrirwolf@gmail.com>
Date: Fri, 24 Feb 2017 17:35:43 -0700
Subject: [PATCH] Use unit type in subsystem structs

---
 ctru-rs/src/gfx.rs          |  8 ++------
 ctru-rs/src/sdmc.rs         | 10 +++-------
 ctru-rs/src/services/apt.rs | 10 +++-------
 ctru-rs/src/services/fs.rs  |  9 +++------
 ctru-rs/src/services/hid.rs |  9 +++------
 ctru-rs/src/srv.rs          | 10 +++-------
 6 files changed, 17 insertions(+), 39 deletions(-)

diff --git a/ctru-rs/src/gfx.rs b/ctru-rs/src/gfx.rs
index 7f819ea..94c53e7 100644
--- a/ctru-rs/src/gfx.rs
+++ b/ctru-rs/src/gfx.rs
@@ -1,15 +1,11 @@
 use libctru::gfx;
 
 use std::default::Default;
-use std::marker::PhantomData;
 use std::ops::Drop;
 
 use services::gspgpu::FramebufferFormat;
 
-pub struct Gfx {
-    // we do this to prevent people from making a Gfx struct manually
-    pd: PhantomData<i32>,
-}
+pub struct Gfx(());
 
 #[derive(Copy, Clone)]
 pub enum Screen {
@@ -135,7 +131,7 @@ impl Gfx {
 impl Default for Gfx {
     fn default() -> Self {
         unsafe { gfx::gfxInitDefault() };
-        Gfx { pd: PhantomData }
+        Gfx(())
     }
 }
 
diff --git a/ctru-rs/src/sdmc.rs b/ctru-rs/src/sdmc.rs
index 6196394..26669ea 100644
--- a/ctru-rs/src/sdmc.rs
+++ b/ctru-rs/src/sdmc.rs
@@ -1,19 +1,15 @@
-use std::marker::PhantomData;
-
 use libctru::sdmc::*;
 
-pub struct Sdmc {
-    pd: PhantomData<i32>,
-}
+pub struct Sdmc(());
 
 impl Sdmc {
     pub fn init() -> ::Result<Sdmc> {
         unsafe {
             let r = sdmcInit();
             if r < 0 {
-                Err(::Error::from(r))
+                Err(r.into())
             } else {
-                Ok(Sdmc { pd: PhantomData })
+                Ok(Sdmc(()))
             }
         }
     }
diff --git a/ctru-rs/src/services/apt.rs b/ctru-rs/src/services/apt.rs
index 0c8e281..f50f2c0 100644
--- a/ctru-rs/src/services/apt.rs
+++ b/ctru-rs/src/services/apt.rs
@@ -1,19 +1,15 @@
-use std::marker::PhantomData;
-
 use libctru::services::apt;
 
-pub struct Apt {
-    pd: PhantomData<i32>
-}
+pub struct Apt(());
 
 impl Apt {
     pub fn init() -> ::Result<Apt> {
         unsafe {
             let r = apt::aptInit();
             if r < 0 {
-                Err(::Error::from(r))
+                Err(r.into())
             } else {
-                Ok(Apt { pd: PhantomData })
+                Ok(Apt(()))
             }
         }
     }
diff --git a/ctru-rs/src/services/fs.rs b/ctru-rs/src/services/fs.rs
index 2a567e2..1c3c449 100644
--- a/ctru-rs/src/services/fs.rs
+++ b/ctru-rs/src/services/fs.rs
@@ -9,7 +9,6 @@ use std::io::Result as IoResult;
 use std::io::ErrorKind as IoErrorKind;
 
 use std::ffi::OsString;
-use std::marker::PhantomData;
 use std::ptr;
 use std::slice;
 use std::mem;
@@ -83,9 +82,7 @@ pub enum ArchiveID {
 /// until an instance of this struct is created.
 ///
 /// The service exits when all instances of this struct go out of scope. 
-pub struct Fs {
-    pd: PhantomData<i32>,
-}
+pub struct Fs(());
 
 /// Handle to an open filesystem archive.
 ///
@@ -304,9 +301,9 @@ impl Fs {
         unsafe {
             let r = fsInit();
             if r < 0 {
-                Err(::Error::from(r))
+                Err(r.into())
             } else {
-                Ok(Fs { pd: PhantomData })
+                Ok(Fs(()))
             }
         }
     }
diff --git a/ctru-rs/src/services/hid.rs b/ctru-rs/src/services/hid.rs
index c703c21..326f0b3 100644
--- a/ctru-rs/src/services/hid.rs
+++ b/ctru-rs/src/services/hid.rs
@@ -1,5 +1,4 @@
 use std::convert::Into;
-use std::marker::PhantomData;
 
 use libctru::services::hid;
 
@@ -73,18 +72,16 @@ impl From<PadKey> for u32 {
     }
 }
 
-pub struct Hid {
-    pd: PhantomData<i32>
-}
+pub struct Hid(());
 
 impl Hid {
     pub fn init() -> ::Result<Hid> {
         unsafe {
             let r = hid::hidInit();
             if r < 0 {
-                Err(::Error::from(r))
+                Err(r.into())
             } else {
-                Ok(Hid { pd: PhantomData })
+                Ok(Hid(()))
             }
         }
     }
diff --git a/ctru-rs/src/srv.rs b/ctru-rs/src/srv.rs
index f0e7026..f7a10c7 100644
--- a/ctru-rs/src/srv.rs
+++ b/ctru-rs/src/srv.rs
@@ -1,19 +1,15 @@
 use libctru::srv::*;
 
-use std::marker::PhantomData;
-
-pub struct Srv {
-    pd: PhantomData<i32>,
-}
+pub struct Srv(());
 
 impl Srv {
     pub fn init() -> ::Result<Srv> {
         unsafe {
             let r = srvInit();
             if r < 0 {
-                Err(::Error::from(r))
+                Err(r.into())
             } else {
-                Ok(Srv { pd: PhantomData })
+                Ok(Srv(()))
             }
         }
     }