Make FsStatusFlags struct fields non-public and add getters

This way new fields can be added later without losing backward compatibility.
This commit is contained in:
Rafał Harabień 2018-06-06 14:17:05 +02:00
parent 0b5b04aca6
commit 85c48d6aec
2 changed files with 14 additions and 4 deletions

View File

@ -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 {}

View File

@ -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]