pub async fn save<T>(
        path: &str,
        entries: Vec<T>,
    ) -> Result<(), CachemError>
    where
        T: Parse {

        let file = OpenOptions::new()
            .write(true)
            .open(path)
            .await?;

        let mut buf = BufStream::new(file);

        u32::from(entries.len() as u32).write(&mut buf).await?;
        for entry in entries {
            entry.write(&mut buf).await?;
        }
        buf.flush().await?;
        Ok(())
    }
/// Writes the internal buffer to the file, clears the buffer and flushes
Writes the internal buffer to the file, clears the buffer and flushes
Writes the internal buffer to the file clears the buffer and flushes
pub async fn save<T>(
        path: &str,
        entries: Vec<T>,
    ) -> Result<(), CachemError>
    where
        T: Parse {
        let file = OpenOptions::new()
            .write(true)
            .open(path)
            .await?;
        let mut buf = BufStream::new(file);
        u32::from(entries.len() as u32).write(&mut buf).await?;
        for entry in entries {
            entry.write(&mut buf).await?;
        }
        buf.flush().await?;
        Ok(())
    }
pub async fn save < T > ( path : & str , entries : Vec < T > , ) -> Result < ( ) , CachemError > where T : Parse { let file = OpenOptions :: new ( ) . write ( true ) . open ( path ) . await ? ; let mut buf = BufStream :: new ( file ) ; u32 :: from ( entries . len ( ) as u32 ) . write ( & mut buf ) . await ? ; for entry in entries { entry . write ( & mut buf ) . await ? ; } buf . flush ( ) . await ? ; Ok ( ( ) ) }
Writes the internal buffer to the file, clears the buffer and flushes
Writes the internal buffer to the file clears the buffer and flushes
path
&str
entries
Vec<T>
path
&str
entries
Vec<T>