pub struct FileWriteCache { /* private fields */ }Expand description
Implement write cache in memory, and update file only if necessary
Implementations§
Source§impl FileWriteCache
impl FileWriteCache
pub fn new<P: Into<PathBuf>>( p: P, fs_reg: &mut dyn FileOperationsRegistrator, ) -> FileWriteCache ⓘ
pub fn update_file_if_necessary(self) -> Result<(), Error>
pub fn take_content(&mut self) -> Vec<u8> ⓘ
pub fn replace_content(&mut self, bytes: Vec<u8>)
pub fn define_item<S: Into<String>>(&mut self, item: S)
pub fn is_item_defined(&self, item: &str) -> bool
Trait Implementations§
Source§impl Write for FileWriteCache
impl Write for FileWriteCache
Source§fn write(&mut self, data: &[u8]) -> Result<usize, Error>
fn write(&mut self, data: &[u8]) -> Result<usize, Error>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<(), Error>
fn flush(&mut self) -> Result<(), Error>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl Freeze for FileWriteCache
impl RefUnwindSafe for FileWriteCache
impl Send for FileWriteCache
impl Sync for FileWriteCache
impl Unpin for FileWriteCache
impl UnsafeUnpin for FileWriteCache
impl UnwindSafe for FileWriteCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more