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
impl<S: Eq + ExtendVec + 'static> Eq for Event<S>
impl<S: ExtendVec + 'static> StructuralPartialEq for Event<S>
Auto Trait Implementations§
impl<S> Freeze for Event<S>
impl<S> RefUnwindSafe for Event<S>where
S: RefUnwindSafe,
impl<S> Send for Event<S>where
S: Send,
impl<S> Sync for Event<S>where
S: Sync,
impl<S> Unpin for Event<S>where
S: Unpin,
impl<S> UnwindSafe for Event<S>where
S: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)