Jelajahi Sumber

Move dummy xattr Attribute implementation into its own module.

Michael Neumann 10 tahun lalu
induk
melakukan
a0105b951d
2 mengubah file dengan 34 tambahan dan 33 penghapusan
  1. 2 33
      src/feature/mod.rs
  2. 32 0
      src/feature/xattr_dummy.rs

+ 2 - 33
src/feature/mod.rs

@@ -6,39 +6,8 @@
 #[cfg(target_os = "linux")] mod xattr_linux;
 #[cfg(target_os = "linux")] pub use self::xattr_linux::Attribute;
 
-#[cfg(not(any(target_os = "macos", target_os = "linux")))] use std::old_io as io;
-#[cfg(not(any(target_os = "macos", target_os = "linux")))]
-
-
-#[derive(Clone)]
-pub struct Attribute;
-
-#[cfg(not(any(target_os = "macos", target_os = "linux")))]
-impl Attribute {
-
-    /// Getter for name
-    pub fn name(&self) -> &str {
-        unimplemented!()
-    }
-
-    /// Getter for size
-    pub fn size(&self) -> usize {
-        unimplemented!()
-    }
-
-    /// Lists the extended attributes. Follows symlinks like `metadata`
-    pub fn list(_: &Path) -> io::IoResult<Vec<Attribute>> {
-        Ok(Vec::new())
-    }
-
-    /// Lists the extended attributes. Does not follow symlinks like `symlink_metadata`
-    pub fn llist(_: &Path) -> io::IoResult<Vec<Attribute>> {
-        Ok(Vec::new())
-    }
-
-    pub fn feature_implemented() -> bool { false }
-}
-
+#[cfg(not(any(target_os = "macos", target_os = "linux")))] mod xattr_dummy;
+#[cfg(not(any(target_os = "macos", target_os = "linux")))] pub use self::xattr_dummy::Attribute;
 
 // Git support
 

+ 32 - 0
src/feature/xattr_dummy.rs

@@ -0,0 +1,32 @@
+use std::io;
+use std::path::Path;
+
+#[derive(Clone)]
+pub struct Attribute;
+
+impl Attribute {
+
+    /// Getter for name
+    pub fn name(&self) -> &str {
+        unimplemented!()
+    }
+
+    /// Getter for size
+    pub fn size(&self) -> usize {
+        unimplemented!()
+    }
+
+    /// Lists the extended attributes. Follows symlinks like `metadata`
+    pub fn list(_: &Path) -> io::Result<Vec<Attribute>> {
+        Ok(Vec::new())
+    }
+
+    /// Lists the extended attributes. Does not follow symlinks like `symlink_metadata`
+    pub fn llist(_: &Path) -> io::Result<Vec<Attribute>> {
+        Ok(Vec::new())
+    }
+
+    pub fn feature_implemented() -> bool { false }
+}
+
+