pub struct EventId { /* private fields */ }Implementations§
source§impl EventId
impl EventId
pub fn from<T>(record: &SerializedEvtxRecord<T>) -> Self
sourcepub fn timestamp(&self) -> &DateTime<Utc>
pub fn timestamp(&self) -> &DateTime<Utc>
Examples found in repository?
src/range.rs (line 12)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.begin().timestamp().cmp(other.begin().timestamp())
}
}
impl PartialOrd for Range {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.begin().timestamp().cmp(other.begin().timestamp()))
}
}
impl Range {
#[allow(dead_code)]
pub fn from(begin: EventId) -> Self {
Self {
events: vec![begin]
}
}
pub fn begin(&self) -> &EventId {
&self.events[0]
}
pub fn end(&self) -> &EventId {
&self.events[self.events.len()-1]
}
#[allow(dead_code)]
pub fn add_event(&mut self, end: EventId) {
assert!(self.can_contain(&end));
self.events.push(end);
}
#[allow(dead_code)]
pub fn can_contain(&self, id: &EventId) -> bool {
id.follows(self.end())
}
#[allow(dead_code)]
pub fn len(&self) -> usize {
self.events.len()
}
#[allow(dead_code)]
pub fn is_empty(&self) -> bool {
self.len() == 0
}
#[allow(dead_code)]
pub fn events(&self) -> std::slice::Iter<'_, EventId> {
self.events.iter()
}
}
impl Display for Range {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{} - {} ({} - {})",
self.begin().timestamp().format("%FT%T"),
self.end().timestamp().format("%FT%T"),
self.begin().event_record_id(),
self.end().event_record_id())
}sourcepub fn event_record_id(&self) -> u64
pub fn event_record_id(&self) -> u64
Trait Implementations§
source§impl Ord for EventId
impl Ord for EventId
source§impl PartialEq<EventId> for EventId
impl PartialEq<EventId> for EventId
source§impl PartialOrd<EventId> for EventId
impl PartialOrd<EventId> for EventId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read more