From 120c9b035c32b196f4abf7176377124f2ba48bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Harabie=C5=84?= Date: Sat, 7 Oct 2017 15:00:27 +0200 Subject: [PATCH] Rename DirReader to DirRawStream. --- src/dir.rs | 22 +++++++++++----------- src/fs.rs | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/dir.rs b/src/dir.rs index 550a23f..9af8966 100644 --- a/src/dir.rs +++ b/src/dir.rs @@ -14,25 +14,25 @@ use fs::{FileSystemRef, DiskSlice}; use file::File; #[derive(Clone)] -pub(crate) enum DirReader<'a, 'b: 'a> { +pub(crate) enum DirRawStream<'a, 'b: 'a> { File(File<'a, 'b>), Root(DiskSlice<'a, 'b>), } -impl <'a, 'b> Read for DirReader<'a, 'b> { +impl <'a, 'b> Read for DirRawStream<'a, 'b> { fn read(&mut self, buf: &mut [u8]) -> io::Result { match self { - &mut DirReader::File(ref mut file) => file.read(buf), - &mut DirReader::Root(ref mut raw) => raw.read(buf), + &mut DirRawStream::File(ref mut file) => file.read(buf), + &mut DirRawStream::Root(ref mut raw) => raw.read(buf), } } } -impl <'a, 'b> Seek for DirReader<'a, 'b> { +impl <'a, 'b> Seek for DirRawStream<'a, 'b> { fn seek(&mut self, pos: SeekFrom) -> io::Result { match self { - &mut DirReader::File(ref mut file) => file.seek(pos), - &mut DirReader::Root(ref mut raw) => raw.seek(pos), + &mut DirRawStream::File(ref mut file) => file.seek(pos), + &mut DirRawStream::Root(ref mut raw) => raw.seek(pos), } } } @@ -202,7 +202,7 @@ impl <'a, 'b> DirEntry<'a, 'b> { panic!("This is a file"); } let file = File::new(self.first_cluster(), None, self.fs); - Dir::new(DirReader::File(file), self.fs) + Dir::new(DirRawStream::File(file), self.fs) } pub fn len(&self) -> u64 { @@ -230,13 +230,13 @@ impl <'a, 'b> fmt::Debug for DirEntry<'a, 'b> { #[derive(Clone)] pub struct Dir<'a, 'b: 'a> { - rdr: DirReader<'a, 'b>, + rdr: DirRawStream<'a, 'b>, fs: FileSystemRef<'a, 'b>, } impl <'a, 'b> Dir<'a, 'b> { - pub(crate) fn new(rdr: DirReader<'a, 'b>, fs: FileSystemRef<'a, 'b>) -> Dir<'a, 'b> { + pub(crate) fn new(rdr: DirRawStream<'a, 'b>, fs: FileSystemRef<'a, 'b>) -> Dir<'a, 'b> { Dir { rdr, fs } } @@ -286,7 +286,7 @@ impl <'a, 'b> Dir<'a, 'b> { #[derive(Clone)] pub struct DirIter<'a, 'b: 'a> { - rdr: DirReader<'a, 'b>, + rdr: DirRawStream<'a, 'b>, fs: FileSystemRef<'a, 'b>, err: bool, } diff --git a/src/fs.rs b/src/fs.rs index 476f49a..dcb35b3 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -7,7 +7,7 @@ use std::io; use byteorder::{LittleEndian, ReadBytesExt}; use file::File; -use dir::{DirReader, Dir}; +use dir::{DirRawStream, Dir}; use table::ClusterIterator; // FAT implementation based on: @@ -125,9 +125,9 @@ impl <'a> FileSystem<'a> { pub fn root_dir<'b>(&'b self) -> Dir<'b, 'a> { let root_rdr = { match self.fat_type { - FatType::Fat12 | FatType::Fat16 => DirReader::Root(DiskSlice::from_sectors( + FatType::Fat12 | FatType::Fat16 => DirRawStream::Root(DiskSlice::from_sectors( self.first_data_sector - self.root_dir_sectors, self.root_dir_sectors, self)), - _ => DirReader::File(File::new(Some(self.boot.bpb.root_dir_first_cluster), None, self)), + _ => DirRawStream::File(File::new(Some(self.boot.bpb.root_dir_first_cluster), None, self)), } }; Dir::new(root_rdr, self)