pub struct EventLog { /* private fields */ }Expand description
Append-only event log for publish operations.
Events are stored in-memory in insertion order.
Implementations§
Source§impl EventLog
impl EventLog
Sourcepub fn record(&mut self, event: PublishEvent)
pub fn record(&mut self, event: PublishEvent)
Record a new event.
Added events are appended and remain in order.
Sourcepub fn write_to_file(&self, path: &Path) -> Result<()>
pub fn write_to_file(&self, path: &Path) -> Result<()>
Write all recorded events to a file in JSONL format.
The file is opened in append mode and existing contents are preserved.
Sourcepub fn read_from_file(path: &Path) -> Result<Self>
pub fn read_from_file(path: &Path) -> Result<Self>
Read all events from a JSONL file.
Returns an empty log when the file does not exist.
Sourcepub fn events_for_package(&self, package: &str) -> Vec<&PublishEvent>
pub fn events_for_package(&self, package: &str) -> Vec<&PublishEvent>
Get all events for a specific package.
Matching is exact against the package field.
Sourcepub fn all_events(&self) -> &[PublishEvent]
pub fn all_events(&self) -> &[PublishEvent]
Get all recorded events.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventLog
impl RefUnwindSafe for EventLog
impl Send for EventLog
impl Sync for EventLog
impl Unpin for EventLog
impl UnsafeUnpin for EventLog
impl UnwindSafe for EventLog
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