From 242e65062600cd04026fb5e485338230852e8ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Harabie=C5=84?= Date: Sun, 3 Jun 2018 16:44:12 +0200 Subject: [PATCH] Reduce number of pub(crate) attributes --- src/dir.rs | 5 ++--- src/dir_entry.rs | 10 +++++----- src/file.rs | 2 +- src/fs.rs | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/dir.rs b/src/dir.rs index f5e2e49..02c523e 100644 --- a/src/dir.rs +++ b/src/dir.rs @@ -23,14 +23,14 @@ pub(crate) enum DirRawStream<'a, 'b: 'a> { } impl <'a, 'b> DirRawStream<'a, 'b> { - pub(crate) fn abs_pos(&self) -> Option { + fn abs_pos(&self) -> Option { match self { &DirRawStream::File(ref file) => file.abs_pos(), &DirRawStream::Root(ref slice) => Some(slice.abs_pos()), } } - pub(crate) fn first_cluster(&self) -> Option { + fn first_cluster(&self) -> Option { match self { &DirRawStream::File(ref file) => file.first_cluster(), &DirRawStream::Root(_) => None, @@ -87,7 +87,6 @@ pub struct Dir<'a, 'b: 'a> { } impl <'a, 'b> Dir<'a, 'b> { - pub(crate) fn new(stream: DirRawStream<'a, 'b>, fs: FileSystemRef<'a, 'b>) -> Dir<'a, 'b> { Dir { stream, fs } } diff --git a/src/dir_entry.rs b/src/dir_entry.rs index f8ae636..3da9a7a 100644 --- a/src/dir_entry.rs +++ b/src/dir_entry.rs @@ -105,7 +105,7 @@ impl DirFileEntryData { &self.name } - pub(crate) fn lowercase_name(&self) -> String { + fn lowercase_name(&self) -> String { let mut name_copy: [u8; 11] = self.name; if self.lowercase_basename() { for c in &mut name_copy[..8] { @@ -146,19 +146,19 @@ impl DirFileEntryData { self.size = size; } - pub(crate) fn is_dir(&self) -> bool { + fn is_dir(&self) -> bool { self.attrs.contains(FileAttributes::DIRECTORY) } - pub(crate) fn is_file(&self) -> bool { + fn is_file(&self) -> bool { !self.is_dir() } - pub(crate) fn lowercase_basename(&self) -> bool { + fn lowercase_basename(&self) -> bool { self.reserved_0 & (1 << 3) != 0 } - pub(crate) fn lowercase_ext(&self) -> bool { + fn lowercase_ext(&self) -> bool { self.reserved_0 & (1 << 4) != 0 } diff --git a/src/file.rs b/src/file.rs index 22cfc90..95f0dde 100644 --- a/src/file.rs +++ b/src/file.rs @@ -76,7 +76,7 @@ impl <'a, 'b> File<'a, 'b> { } } - pub(crate) fn flush_dir_entry(&mut self) -> io::Result<()> { + fn flush_dir_entry(&mut self) -> io::Result<()> { if let Some(ref mut e) = self.entry { e.flush(self.fs)?; } diff --git a/src/fs.rs b/src/fs.rs index adf3753..44ae969 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -421,11 +421,11 @@ impl <'a> FileSystem<'a> { Dir::new(root_rdr, self) } - pub(crate) fn offset_from_sector(&self, sector: u32) -> u64 { + fn offset_from_sector(&self, sector: u32) -> u64 { (sector as u64) * self.bpb.bytes_per_sector as u64 } - pub(crate) fn sector_from_cluster(&self, cluster: u32) -> u32 { + fn sector_from_cluster(&self, cluster: u32) -> u32 { ((cluster - 2) * self.bpb.sectors_per_cluster as u32) + self.first_data_sector }