pub struct TrackedPatch {
pub patch: Patch,
pub id: Option<String>,
pub timestamp: Option<u64>,
pub source: Option<String>,
pub description: Option<String>,
}Expand description
A patch with tracking metadata.
TrackedPatch wraps a Patch with additional information useful for
debugging, auditing, and conflict detection.
§Examples
use tirea_state::{Patch, TrackedPatch, Op, path};
use serde_json::json;
let patch = Patch::new()
.with_op(Op::set(path!("counter"), json!(1)));
let tracked = TrackedPatch::new(patch)
.with_id("patch-001")
.with_source("user-service");Fields§
§patch: PatchThe underlying patch.
id: Option<String>Unique identifier for this patch.
timestamp: Option<u64>Timestamp when this patch was created (Unix epoch millis).
source: Option<String>Source/origin of this patch (e.g., service name, user ID).
description: Option<String>Optional description of what this patch does.
Implementations§
Source§impl TrackedPatch
impl TrackedPatch
Sourcepub fn with_timestamp(self, ts: u64) -> Self
pub fn with_timestamp(self, ts: u64) -> Self
Set the timestamp (builder pattern).
Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Set the source (builder pattern).
Sourcepub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Set the description (builder pattern).
Sourcepub fn into_patch(self) -> Patch
pub fn into_patch(self) -> Patch
Consume and return the underlying patch.
Trait Implementations§
Source§impl Clone for TrackedPatch
impl Clone for TrackedPatch
Source§fn clone(&self) -> TrackedPatch
fn clone(&self) -> TrackedPatch
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TrackedPatch
impl Debug for TrackedPatch
Source§impl<'de> Deserialize<'de> for TrackedPatch
impl<'de> Deserialize<'de> for TrackedPatch
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
Source§impl From<Patch> for TrackedPatch
impl From<Patch> for TrackedPatch
Auto Trait Implementations§
impl Freeze for TrackedPatch
impl RefUnwindSafe for TrackedPatch
impl Send for TrackedPatch
impl Sync for TrackedPatch
impl Unpin for TrackedPatch
impl UnwindSafe for TrackedPatch
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