pub struct Event<S: ExtendVec + 'static = Vec<u8>> { /* private fields */ }
Expand description
A change of data.
Implementations§
source§impl<S: ExtendVec + 'static> Event<S>
impl<S: ExtendVec + 'static> Event<S>
sourcepub fn new(kind: Kind<S>, sender: &Manager) -> Self
pub fn new(kind: Kind<S>, sender: &Manager) -> Self
Creates a new event from kind
.
Create an Event
with the Self::timestamp
set to the current time.
sourcepub fn with_timestamp(self, timestamp: SystemTime) -> Self
pub fn with_timestamp(self, timestamp: SystemTime) -> Self
Override Self::timestamp
with timestamp
.
NOTE: Be very careful with this. timestamp
MUST be within a second of real time,
else you risk wrong results from the sync mechanism, forcing crate::MessageKind::HashCheck
.
sourcepub fn inner(&self) -> &Kind<S>
pub fn inner(&self) -> &Kind<S>
Returns a reference to the inner Kind
where all the event data is stored.
sourcepub fn timestamp(&self) -> SystemTime
pub fn timestamp(&self) -> SystemTime
Get the timestamp of this event.
sourcepub fn diff(&self) -> Option<&Difference<S>>
pub fn diff(&self) -> Option<&Difference<S>>
Get the [Difference
], if Self::inner
is Kind::Modify
.
sourcepub fn latest_event_timestamp(&self) -> SystemTime
pub fn latest_event_timestamp(&self) -> SystemTime
Get the timestamp of the last event observed by the issuer of this event.
Trait Implementations§
source§impl<'de, S> Deserialize<'de> for Event<S>where
S: Deserialize<'de> + ExtendVec + 'static,
impl<'de, S> Deserialize<'de> for Event<S>where S: Deserialize<'de> + ExtendVec + 'static,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more