pub fn open_root_dir(&mut self, volume: &Volume) -> Result<Directory, Error<D::Error>> {
        // Find a free directory entry, and check the root dir isn't open. As
        // we already know the root dir's magic cluster number, we can do both
        // checks in one loop.
        let mut open_dirs_row = None;
        for (i, d) in self.open_dirs.iter().enumerate() {
            if *d == (volume.idx, Cluster::ROOT_DIR) {
                return Err(Error::DirAlreadyOpen);
            }
            if d.1 == Cluster::INVALID {
                open_dirs_row = Some(i);
                break;
            }
        }
        let open_dirs_row = open_dirs_row.ok_or(Error::TooManyOpenDirs)?;
        // Remember this open directory
        self.open_dirs[open_dirs_row] = (volume.idx, Cluster::ROOT_DIR);
        Ok(Directory {
            cluster: Cluster::ROOT_DIR,
            entry: None,
        })
    }
/// Open a directory. You can then read the directory entries in a random
/// order using `get_directory_entry`.
///
/// TODO: Work out how to prevent damage occuring to the file system while
/// this directory handle is open. In particular, stop this directory
/// being unlinked.
Open a directory. You can then read the directory entries in a random
order using `get_directory_entry`.

Work out how to prevent damage occuring to the file system while
this directory handle is open. In particular, stop this directory
being unlinked.
Open a directory . You can then read the directory entries in a random order using ` get_directory_entry ` . Work out how to prevent damage occuring to the file system while this directory handle is open . In particular stop this directory being unlinked .
pub fn open_root_dir(&mut self, volume: &Volume) -> Result<Directory, Error<D::Error>> {
        // Find a free directory entry, and check the root dir isn't open. As
        // we already know the root dir's magic cluster number, we can do both
        // checks in one loop.
        let mut open_dirs_row = None;
        for (i, d) in self.open_dirs.iter().enumerate() {
            if *d == (volume.idx, Cluster::ROOT_DIR) {
                return Err(Error::DirAlreadyOpen);
            }
            if d.1 == Cluster::INVALID {
                open_dirs_row = Some(i);
                break;
            }
        }
        let open_dirs_row = open_dirs_row.ok_or(Error::TooManyOpenDirs)?;
        // Remember this open directory
        self.open_dirs[open_dirs_row] = (volume.idx, Cluster::ROOT_DIR);
        Ok(Directory {
            cluster: Cluster::ROOT_DIR,
            entry: None,
        })
    }
pub fn open_root_dir ( & mut self , volume : & Volume ) -> Result < Directory , Error < D :: Error > > { // Find a free directory entry, and check the root dir isn't open. As // we already know the root dir's magic cluster number, we can do both // checks in one loop. let mut open_dirs_row = None ; for ( i , d ) in self . open_dirs . iter ( ) . enumerate ( ) { if * d == ( volume . idx , Cluster :: ROOT_DIR ) { return Err ( Error :: DirAlreadyOpen ) ; } if d . 1 == Cluster :: INVALID { open_dirs_row = Some ( i ) ; break ; } } let open_dirs_row = open_dirs_row . ok_or ( Error :: TooManyOpenDirs ) ? ; // Remember this open directory self . open_dirs [ open_dirs_row ] = ( volume . idx , Cluster :: ROOT_DIR ) ; Ok ( Directory { cluster : Cluster :: ROOT_DIR , entry : None , } ) }
Open a directory.
Open a directory .
&mut self
volume
&Volume
&mut self
volume
&Volume