From 85c48d6aec32259b2123b1d9305bbc86383e0a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Harabie=C5=84?= Date: Wed, 6 Jun 2018 14:17:05 +0200 Subject: [PATCH] Make FsStatusFlags struct fields non-public and add getters This way new fields can be added later without losing backward compatibility. --- src/fs.rs | 14 ++++++++++++-- tests/read.rs | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/fs.rs b/src/fs.rs index ea3c39d..52d2ab1 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -38,8 +38,18 @@ impl FatType { } pub struct FsStatusFlags { - pub dirty: bool, - pub io_error: bool, + pub(crate) dirty: bool, + pub(crate) io_error: bool, +} + +impl FsStatusFlags { + pub fn dirty(&self) -> bool { + self.dirty + } + + pub fn io_error(&self) -> bool { + self.io_error + } } pub trait ReadSeek: Read + Seek {} diff --git a/tests/read.rs b/tests/read.rs index 7640aa8..4c04669 100644 --- a/tests/read.rs +++ b/tests/read.rs @@ -195,8 +195,8 @@ fn test_volume_metadata_fat32() { fn test_status_flags(fs: FileSystem) { let status_flags = fs.read_status_flags().unwrap(); - assert_eq!(status_flags.dirty, false); - assert_eq!(status_flags.io_error, false); + assert_eq!(status_flags.dirty(), false); + assert_eq!(status_flags.io_error(), false); } #[test]