pub struct EventName(/* private fields */);Implementations§
Source§impl EventName
impl EventName
Sourcepub fn new(value: impl Into<String>) -> EventName
pub fn new(value: impl Into<String>) -> EventName
Examples found in repository?
examples/basic_usage.rs (line 6)
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 as_str(&self) -> &str
pub fn as_str(&self) -> &str
Examples found in repository?
examples/basic_usage.rs (line 12)
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}Trait Implementations§
Source§impl Ord for EventName
impl Ord for EventName
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for EventName
impl PartialOrd for EventName
impl Eq for EventName
impl StructuralPartialEq for EventName
Auto Trait Implementations§
impl Freeze for EventName
impl RefUnwindSafe for EventName
impl Send for EventName
impl Sync for EventName
impl Unpin for EventName
impl UnsafeUnpin for EventName
impl UnwindSafe for EventName
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