Reduce number of pub(crate) attributes

This commit is contained in:
Rafał Harabień 2018-06-03 16:44:12 +02:00
parent be0d969f7b
commit 242e650626
4 changed files with 10 additions and 11 deletions

View File

@ -23,14 +23,14 @@ pub(crate) enum DirRawStream<'a, 'b: 'a> {
}
impl <'a, 'b> DirRawStream<'a, 'b> {
pub(crate) fn abs_pos(&self) -> Option<u64> {
fn abs_pos(&self) -> Option<u64> {
match self {
&DirRawStream::File(ref file) => file.abs_pos(),
&DirRawStream::Root(ref slice) => Some(slice.abs_pos()),
}
}
pub(crate) fn first_cluster(&self) -> Option<u32> {
fn first_cluster(&self) -> Option<u32> {
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 }
}

View File

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

View File

@ -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)?;
}

View File

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