pub fn add(&mut self, file_name: &str, source: &str) -> Result<u32, &'static str> {
        if let Some(id) = self.names.get(&(false, file_name)) {
            return Err("already exists");
        }

        let file_id = self.files.len() as u32;
        let file = File::new(&*self.buckets, file_name, &source);
        self.files.push(file);
        self.names.insert((false, file.name), file_id);

        Ok(file_id)
    }
/// Add a file to the database, returning the handle that can be used to
/// refer to it again. Errors if the file already exists in the database.
Add a file to the database, returning the handle that can be used to
refer to it again. Errors if the file already exists in the database.
Add a file to the database returning the handle that can be used to refer to it again . Errors if the file already exists in the database .
pub fn add(&mut self, file_name: &str, source: &str) -> Result<u32, &'static str> {
        if let Some(id) = self.names.get(&(false, file_name)) {
            return Err("already exists");
        }
        let file_id = self.files.len() as u32;
        let file = File::new(&*self.buckets, file_name, &source);
        self.files.push(file);
        self.names.insert((false, file.name), file_id);
        Ok(file_id)
    }
pub fn add ( & mut self , file_name : & str , source : & str ) -> Result < u32 , & ' static str > { if let Some ( id ) = self . names . get ( & ( false , file_name ) ) { return Err ( " " ) ; } let file_id = self . files . len ( ) as u32 ; let file = File :: new ( & * self . buckets , file_name , & source ) ; self . files . push ( file ) ; self . names . insert ( ( false , file . name ) , file_id ) ; Ok ( file_id ) }
Add a file to the database, returning the handle that can be used to
refer to it again.
Add a file to the database returning the handle that can be used to refer to it again .
&mut self
file_name
&str
source
&str
&mut self
file_name
&str
source
&str