pub async fn finalize(&mut self, extension: &str) -> std::io::Result<()> {
        self.file.sync_all().await?;
        let new_path = format!("{}{}", self.path,extension);
        let new_path = Path::new(&new_path);
        let res = fs::rename(Path::new(&self.path), new_path).await;
        self.file = fs::File::open(new_path).await?; // TODO: Check if rename breaks connection or not
        self.path.push_str(extension);
        res
    }
/// Write final bytes and add extension to file
Write final bytes and add extension to file
Write final bytes and add extension to file
pub async fn finalize(&mut self, extension: &str) -> std::io::Result<()> {
        self.file.sync_all().await?;
        let new_path = format!("{}{}", self.path,extension);
        let new_path = Path::new(&new_path);
        let res = fs::rename(Path::new(&self.path), new_path).await;
        self.file = fs::File::open(new_path).await?; // TODO: Check if rename breaks connection or not
        self.path.push_str(extension);
        res
    }
pub async fn finalize ( & mut self , extension : & str ) -> std :: io :: Result < ( ) > { self . file . sync_all ( ) . await ? ; let new_path = format ! ( " " self path extension ) ; let new_path = Path :: new ( & new_path ) ; let res = fs :: rename ( Path :: new ( & self . path ) , new_path ) . await ; self . file = fs :: File :: open ( new_path ) . await ? ; // TODO: Check if rename breaks connection or not self . path . push_str ( extension ) ; res }
Write final bytes and add extension to file
Write final bytes and add extension to file
&mut self
extension
&str
&mut self
extension
&str