pub fn write(&mut self, document: &T) -> Result<(), DatabaseError> {
        let buf = vec_to_binary(std::array::from_ref(document))?;
        self.file.seek(SeekFrom::End(0))?;
        self.file.write_all(&buf)?;
        Ok(())
    }
/// Writes the provided serializable document to disk. If no file is found,
/// a new file will be created and written to.
///
/// # Errors
///
/// - `std::num::TryFromIntError` occurs when a document you are inserting
/// takes up more space than `u32::MAX` bytes.
///
/// - `std::io::Error`
///
/// - `bincode::Error` when the document provided fails to serialize for some reason.
Writes the provided serializable document to disk. If no file is found,
a new file will be created and written to.
Writes the provided serializable document to disk . If no file is found a new file will be created and written to .
pub fn write(&mut self, document: &T) -> Result<(), DatabaseError> {
        let buf = vec_to_binary(std::array::from_ref(document))?;
        self.file.seek(SeekFrom::End(0))?;
        self.file.write_all(&buf)?;
        Ok(())
    }
pub fn write ( & mut self , document : & T ) -> Result < ( ) , DatabaseError > { let buf = vec_to_binary ( std :: array :: from_ref ( document ) ) ? ; self . file . seek ( SeekFrom :: End ( 0 ) ) ? ; self . file . write_all ( & buf ) ? ; Ok ( ( ) ) }
Writes the provided serializable document to disk.
Writes the provided serializable document to disk .
&mut self
document
&T
&mut self
document
&T
errors
`std::num::TryFromIntError` occurs when a document you are inserting
takes up more space than `u32::MAX` bytes.



`bincode::Error` when the document provided fails to serialize for some reason.
` std :: num :: TryFromIntError ` occurs when a document you are inserting takes up more space than ` u32 :: MAX ` bytes . ` bincode :: Error ` when the document provided fails to serialize for some reason .