From 75a6c32360832b08f30dc918d40e184d50cd077b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Harabie=C5=84?= Date: Wed, 6 Jun 2018 14:29:38 +0200 Subject: [PATCH] Add derived traits for FsStatusFlags and add Eq for some structs --- src/dir_entry.rs | 6 +++--- src/fs.rs | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/dir_entry.rs b/src/dir_entry.rs index 605be08..fe63413 100644 --- a/src/dir_entry.rs +++ b/src/dir_entry.rs @@ -429,7 +429,7 @@ impl DirEntryData { } /// DOS compatible date -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] pub struct Date { pub year: u16, pub month: u16, @@ -449,7 +449,7 @@ impl Date { } /// DOS compatible time -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] pub struct Time { pub hour: u16, pub min: u16, @@ -468,7 +468,7 @@ impl Time { } /// DOS compatible date and time -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] pub struct DateTime { pub date: Date, pub time: Time, diff --git a/src/fs.rs b/src/fs.rs index 52d2ab1..5236f86 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -20,7 +20,7 @@ use core::str; // http://wiki.osdev.org/FAT // https://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum FatType { Fat12, Fat16, Fat32, } @@ -37,6 +37,7 @@ impl FatType { } } +#[derive(Copy, Clone, Eq, PartialEq, Debug)] pub struct FsStatusFlags { pub(crate) dirty: bool, pub(crate) io_error: bool, @@ -215,7 +216,7 @@ impl Default for BootRecord { } } -#[derive(Default, Debug, Clone)] +#[derive(Clone, Default, Debug)] struct FsInfoSector { free_cluster_count: Option, next_free_cluster: Option, @@ -290,7 +291,7 @@ impl FsInfoSector { } /// FAT filesystem options. -#[derive(Debug, Clone, Copy)] +#[derive(Copy, Clone, Debug)] pub struct FsOptions { pub(crate) update_accessed_date: bool, pub(crate) update_fs_info: bool, @@ -318,7 +319,7 @@ impl FsOptions { } /// FAT filesystem statistics -#[derive(Debug, Clone, Copy)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] pub struct FileSystemStats { /// Cluster size in bytes cluster_size: u32,