pub struct CacheWriter { /* private fields */ }Expand description
Writes events to on-disk binary cache format.
Implementations§
Source§impl CacheWriter
impl CacheWriter
Sourcepub fn push_event(&mut self, event: &Event)
pub fn push_event(&mut self, event: &Event)
Add one event to the writer buffer.
Sourcepub fn write_to_file(&self, path: &Path) -> Result<CacheStats>
pub fn write_to_file(&self, path: &Path) -> Result<CacheStats>
Encode all buffered events and write them to path.
Parent directories are created automatically.
§Errors
Returns an error if encoding or file I/O fails.
Sourcepub fn append_incremental(
existing: &Path,
new_events: &[Event],
) -> Result<CacheStats>
pub fn append_incremental( existing: &Path, new_events: &[Event], ) -> Result<CacheStats>
Append new_events to an existing cache file, rewriting the whole file.
If the cache file does not exist, this behaves like a normal write with
just new_events.
§Errors
Returns an error if decoding existing data, encoding, or file I/O fails.
Trait Implementations§
Source§impl Debug for CacheWriter
impl Debug for CacheWriter
Source§impl Default for CacheWriter
impl Default for CacheWriter
Source§fn default() -> CacheWriter
fn default() -> CacheWriter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CacheWriter
impl RefUnwindSafe for CacheWriter
impl Send for CacheWriter
impl Sync for CacheWriter
impl Unpin for CacheWriter
impl UnsafeUnpin for CacheWriter
impl UnwindSafe for CacheWriter
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