pub struct Metadata {
pub timestamp: Option<u64>,
pub user_id: Option<String>,
pub causality: Option<VectorClock>,
pub custom: Option<Vec<u8>>,
}Available on crate feature
extensions only.Expand description
Metadata attached to a sync message
Fields§
§timestamp: Option<u64>Timestamp (microseconds since epoch)
user_id: Option<String>User/session identifier
causality: Option<VectorClock>Causality information
custom: Option<Vec<u8>>Custom application data
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn with_timestamp() -> Self
pub fn with_timestamp() -> Self
Create with current timestamp
Sourcepub fn set_timestamp(&mut self, time: SystemTime)
pub fn set_timestamp(&mut self, time: SystemTime)
Set timestamp from SystemTime
Sourcepub fn get_timestamp(&self) -> Option<SystemTime>
pub fn get_timestamp(&self) -> Option<SystemTime>
Get timestamp as SystemTime
Sourcepub fn set_user_id(&mut self, user_id: impl Into<String>)
pub fn set_user_id(&mut self, user_id: impl Into<String>)
Set user ID
Sourcepub fn set_causality(&mut self, clock: VectorClock)
pub fn set_causality(&mut self, clock: VectorClock)
Set causality
Sourcepub fn set_custom(&mut self, data: Vec<u8>)
pub fn set_custom(&mut self, data: Vec<u8>)
Set custom data
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnwindSafe for Metadata
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