pub fn insert_lowest(&mut self, fd: FileDescriptor) -> Option<FileIdx> {
        for (idx, file) in self.files.iter_mut().enumerate() {
            // TODO: debug
            if idx < 3 {
                continue;
            }

            if file.is_none() {
                *file = Some(fd);
                return Some(idx);
            }
        }

        if self.files.len() < MAX_FILES {
            self.files.push(Some(fd));
            Some(self.files.len() - 1)
        } else {
            None
        }
    }
/// Insert file into lowest available index.
Insert file into lowest available index.
Insert file into lowest available index .
pub fn insert_lowest(&mut self, fd: FileDescriptor) -> Option<FileIdx> {
        for (idx, file) in self.files.iter_mut().enumerate() {
            // TODO: debug
            if idx < 3 {
                continue;
            }
            if file.is_none() {
                *file = Some(fd);
                return Some(idx);
            }
        }
        if self.files.len() < MAX_FILES {
            self.files.push(Some(fd));
            Some(self.files.len() - 1)
        } else {
            None
        }
    }
pub fn insert_lowest ( & mut self , fd : FileDescriptor ) -> Option < FileIdx > { for ( idx , file ) in self . files . iter_mut ( ) . enumerate ( ) { // TODO: debug if idx < 3 { continue ; } if file . is_none ( ) { * file = Some ( fd ) ; return Some ( idx ) ; } } if self . files . len ( ) < MAX_FILES { self . files . push ( Some ( fd ) ) ; Some ( self . files . len ( ) - 1 ) } else { None } }
Insert file into lowest available index.
Insert file into lowest available index .
&mut self
fd
FileDescriptor
&mut self
fd
FileDescriptor