pub struct EventLog<E> { /* private fields */ }Implementations§
Source§impl<E> EventLog<E>
impl<E> EventLog<E>
Sourcepub const fn new() -> EventLog<E>
pub const fn new() -> EventLog<E>
Examples found in repository?
examples/basic_usage.rs (line 15)
4fn main() {
5 let event = EventEnvelope::new(
6 EventName::new("command.started"),
7 EventKind::Started,
8 EventSource::new("cli"),
9 "rustuse build",
10 );
11
12 assert_eq!(event.name.as_str(), "command.started");
13 assert_eq!(event.payload, "rustuse build");
14
15 let mut log = EventLog::new();
16 log.append(EventName::new("test.started"));
17 log.append(EventName::new("test.passed"));
18
19 assert_eq!(log.len(), 2);
20 assert_eq!(log.last().map(EventName::as_str), Some("test.passed"));
21}Sourcepub fn append(&mut self, event: E)
pub fn append(&mut self, event: E)
Examples found in repository?
examples/basic_usage.rs (line 16)
4fn main() {
5 let event = EventEnvelope::new(
6 EventName::new("command.started"),
7 EventKind::Started,
8 EventSource::new("cli"),
9 "rustuse build",
10 );
11
12 assert_eq!(event.name.as_str(), "command.started");
13 assert_eq!(event.payload, "rustuse build");
14
15 let mut log = EventLog::new();
16 log.append(EventName::new("test.started"));
17 log.append(EventName::new("test.passed"));
18
19 assert_eq!(log.len(), 2);
20 assert_eq!(log.last().map(EventName::as_str), Some("test.passed"));
21}pub fn entries(&self) -> &[E]
Sourcepub fn last(&self) -> Option<&E>
pub fn last(&self) -> Option<&E>
Examples found in repository?
examples/basic_usage.rs (line 20)
4fn main() {
5 let event = EventEnvelope::new(
6 EventName::new("command.started"),
7 EventKind::Started,
8 EventSource::new("cli"),
9 "rustuse build",
10 );
11
12 assert_eq!(event.name.as_str(), "command.started");
13 assert_eq!(event.payload, "rustuse build");
14
15 let mut log = EventLog::new();
16 log.append(EventName::new("test.started"));
17 log.append(EventName::new("test.passed"));
18
19 assert_eq!(log.len(), 2);
20 assert_eq!(log.last().map(EventName::as_str), Some("test.passed"));
21}Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Examples found in repository?
examples/basic_usage.rs (line 19)
4fn main() {
5 let event = EventEnvelope::new(
6 EventName::new("command.started"),
7 EventKind::Started,
8 EventSource::new("cli"),
9 "rustuse build",
10 );
11
12 assert_eq!(event.name.as_str(), "command.started");
13 assert_eq!(event.payload, "rustuse build");
14
15 let mut log = EventLog::new();
16 log.append(EventName::new("test.started"));
17 log.append(EventName::new("test.passed"));
18
19 assert_eq!(log.len(), 2);
20 assert_eq!(log.last().map(EventName::as_str), Some("test.passed"));
21}pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<E> PartialEq for EventLog<E>where
E: PartialEq,
impl<E> PartialEq for EventLog<E>where
E: PartialEq,
impl<E> Eq for EventLog<E>where
E: Eq,
impl<E> StructuralPartialEq for EventLog<E>
Auto Trait Implementations§
impl<E> Freeze for EventLog<E>
impl<E> RefUnwindSafe for EventLog<E>where
E: RefUnwindSafe,
impl<E> Send for EventLog<E>where
E: Send,
impl<E> Sync for EventLog<E>where
E: Sync,
impl<E> Unpin for EventLog<E>where
E: Unpin,
impl<E> UnsafeUnpin for EventLog<E>
impl<E> UnwindSafe for EventLog<E>where
E: UnwindSafe,
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